Class NexusTestUtils

java.lang.Object
org.eclipse.dawnsci.nexus.test.utilities.NexusTestUtils

public class NexusTestUtils extends Object
  • Constructor Details

    • NexusTestUtils

      public NexusTestUtils()
  • Method Details

    • setUpServices

      public static void setUpServices()
    • createNexusFile

      public static NexusFile createNexusFile(String path) throws NexusException
      Create a new Nexus file (overwriting any existing one)
      Parameters:
      path -
      Returns:
      Nexus file
      Throws:
      NexusException
    • createNexusFile

      public static NexusFile createNexusFile(String path, boolean enableSWMR) throws NexusException
      Create a new Nexus file (overwriting any existing one)
      Parameters:
      path -
      enableSWMR -
      Returns:
      Nexus file
      Throws:
      NexusException
    • saveNexusFile

      public static void saveNexusFile(String filePath, NXroot rootNode) throws NexusException
      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 using NexusFile to create the nodes.

      Parameters:
      filePath - file path
      rootNode - root node
      Throws:
      NexusException
    • saveNexusFile

      public static void saveNexusFile(TreeFile nexusTree) throws NexusException
      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 using NexusFile to create the nodes.

      Parameters:
      nexusTree - nexus tree
      Throws:
      NexusException
    • openNexusFile

      public static NexusFile openNexusFile(String path) throws NexusException
      Open an existing Nexus file to modify
      Parameters:
      path -
      Returns:
      Nexus file
      Throws:
      NexusException
    • openNexusFileReadOnly

      public static NexusFile openNexusFileReadOnly(String path) throws NexusException
      Open an existing Nexus file to read only
      Parameters:
      path -
      Returns:
      Nexus file
      Throws:
      NexusException
    • loadNexusFile

      public static TreeFile loadNexusFile(String filePath, boolean readOnly) throws NexusException
      Loads the nexus file with the given path.
      Parameters:
      filePath -
      readOnly -
      Returns:
      Throws:
      NexusException
    • deleteFile

      public static void deleteFile(String filename) throws Exception
      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

      public static Node getNode(NXroot root, String path)