Class TestEnvContext


  • public class TestEnvContext
    extends java.lang.Object
    A table representing the collection of environments found in a set of environment files.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TestEnvContext.Fault
      This exception is to report problems using TestEnvContext objects.
    • Constructor Summary

      Constructors 
      Constructor Description
      TestEnvContext​(java.io.File... files)
      Create a context from a set of environment (.jte) files.
      TestEnvContext​(java.util.Map<java.lang.String,​java.lang.String>[] tables, java.lang.String... tableNames)
      Create a context from a specified set of named tables.
      TestEnvContext​(java.util.Map<java.lang.String,​java.lang.String> table, java.lang.String tableName)
      Create a context from a named table.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      TestEnvironment getEnv​(java.lang.String name)
      Get a environment from this set of environments.
      java.lang.String[] getEnvMenuNames()
      Get an array containing all the names of environments that should appear in a menu of valid environment names.
      java.lang.String[] getEnvNames()
      Get an array containing all the names of environments in this set of environments.
      boolean isValidEnv​(java.lang.String name)
      Check if a name matches the name of one of the environments in this set of environments.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TestEnvContext

        public TestEnvContext​(java.io.File... files)
                       throws TestEnvContext.Fault
        Create a context from a set of environment (.jte) files.
        Parameters:
        files - The environment files to read
        Throws:
        TestEnvContext.Fault - if an error is found while reading the files
      • TestEnvContext

        public TestEnvContext​(java.util.Map<java.lang.String,​java.lang.String>[] tables,
                              java.lang.String... tableNames)
        Create a context from a specified set of named tables.
        Parameters:
        tables - An array of tables giving the properties to be read
        tableNames - An array of names, one for each table in the tables array, that will be used to identify the source of the properties in any environments that are created
      • TestEnvContext

        public TestEnvContext​(java.util.Map<java.lang.String,​java.lang.String> table,
                              java.lang.String tableName)
        Create a context from a named table.
        Parameters:
        table - A table giving the properties to be read
        tableName - The name that will be used to identify the source of the properties in any environments that are created.
    • Method Detail

      • getEnv

        public TestEnvironment getEnv​(java.lang.String name)
                               throws TestEnvironment.Fault
        Get a environment from this set of environments.
        Parameters:
        name - the name of the desired environment
        Returns:
        the specified environment, or null if not found
        Throws:
        TestEnvironment.Fault - if there is a problem creating the specified environment
      • isValidEnv

        public boolean isValidEnv​(java.lang.String name)
        Check if a name matches the name of one of the environments in this set of environments.
        Parameters:
        name - the name to check
        Returns:
        true if and only if the name matches the name of one of the environments in trhis set of environments
      • getEnvNames

        public java.lang.String[] getEnvNames()
        Get an array containing all the names of environments in this set of environments.
        Returns:
        an array containing the names of all the environments in this set
      • getEnvMenuNames

        public java.lang.String[] getEnvMenuNames()
        Get an array containing all the names of environments that should appear in a menu of valid environment names. This is all environment names, excluding those environments that define an entry "menu=false".
        Returns:
        an array containing the names of all the environments in this set that should appear in a menu of valid environment names