Class NexusTestUtils
java.lang.Object
org.eclipse.dawnsci.nexus.test.utilities.NexusTestUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NexusFilecreateNexusFile(String path) Create a new Nexus file (overwriting any existing one)static NexusFilecreateNexusFile(String path, boolean enableSWMR) Create a new Nexus file (overwriting any existing one)static voiddeleteFile(String filename) Utility method to delete a file if it exists.static Nodestatic TreeFileloadNexusFile(String filePath, boolean readOnly) Loads the nexus file with the given path.static NexusFileopenNexusFile(String path) Open an existing Nexus file to modifystatic NexusFileopenNexusFileReadOnly(String path) Open an existing Nexus file to read onlystatic voidsaveNexusFile(String filePath, NXroot rootNode) Save the NeXus tree with the given root node to the given path.static voidsaveNexusFile(TreeFile nexusTree) Save the given NeXus file tree.static void
-
Constructor Details
-
NexusTestUtils
public NexusTestUtils()
-
-
Method Details
-
setUpServices
public static void setUpServices() -
createNexusFile
Create a new Nexus file (overwriting any existing one)- Parameters:
path-- Returns:
- Nexus file
- Throws:
NexusException
-
createNexusFile
Create a new Nexus file (overwriting any existing one)- Parameters:
path-enableSWMR-- Returns:
- Nexus file
- Throws:
NexusException
-
saveNexusFile
Save the NeXus tree with the given root node to the given path.Use this method when the NeXus tree has been created using the NeXus base classes (subinterfaces of
NXobject), rather than usingNexusFileto create the nodes.- Parameters:
filePath- file pathrootNode- root node- Throws:
NexusException
-
saveNexusFile
Save the given NeXus file tree.Use this method when the NeXus tree has been created using the NeXus base classes (subinterfaces of
NXobject), rather than usingNexusFileto create the nodes.- Parameters:
nexusTree- nexus tree- Throws:
NexusException
-
openNexusFile
Open an existing Nexus file to modify- Parameters:
path-- Returns:
- Nexus file
- Throws:
NexusException
-
openNexusFileReadOnly
Open an existing Nexus file to read only- Parameters:
path-- Returns:
- Nexus file
- Throws:
NexusException
-
loadNexusFile
Loads the nexus file with the given path.- Parameters:
filePath-readOnly-- Returns:
- Throws:
NexusException
-
deleteFile
Utility method to delete a file if it exists.- Parameters:
file- file to delete- Throws:
Exception- if the file couldn't be deleted for any reason
-
getNode
-