Class Stage


  • public class Stage
    extends java.lang.Object
    A stage is an area (directory) in which a version of the assignment, either submitted or gold, can be built and run.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Stage.BuildResult  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Delete the entire staging area after use.
      java.lang.String getBuildCommand()
      Determine the command used to build the code.
      java.lang.String getLaunchCommand​(java.lang.String commandFromProperties)
      Get the launch command for this stage.
      java.nio.file.Path getStageDir()  
      java.lang.String parameterSubstitution​(java.lang.String launchCommandStr)
      Scans a string for shortcuts, replacing by the appropriate string.
      void setupStage()
      Set up the contents of a stage, in preparation for building.
      • Methods inherited from class java.lang.Object

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

      • Stage

        public Stage​(Assignment asst,
                     Submission submission,
                     TestSuiteProperties suiteProperties)
        Create a new stage for submitted code.
        Parameters:
        asst - the assignment that this test suite is intended to assess.
        submission - the submission being graded.
        suiteProperties - info about the suite this is a stage for.
      • Stage

        public Stage​(Assignment asst,
                     TestSuiteProperties suiteProperties)
        Create a new gold version stage.
        Parameters:
        asst - the assignment that this test suite is intended to assess.
        suiteProperties - info about the suite this is a stage for.
    • Method Detail

      • clear

        public void clear()
        Delete the entire staging area after use.
      • getBuildCommand

        public java.lang.String getBuildCommand()
        Determine the command used to build the code. Can be set as a suite property or will attempt to infer the command from the stage directory contents.
        Returns:
        a build command
        Throws:
        TestConfigurationError - if no build command can be determined.
      • setupStage

        public void setupStage()
        Set up the contents of a stage, in preparation for building.
      • getStageDir

        public java.nio.file.Path getStageDir()
        Returns:
        the stage directory
      • getLaunchCommand

        public java.lang.String getLaunchCommand​(java.lang.String commandFromProperties)
        Get the launch command for this stage. If not specified as a property, will attempt to indef a suitable launch command from the stage contents.
        Parameters:
        commandFromProperties -
        Returns:
        the launch command, or "" if none could be inferred.
      • parameterSubstitution

        public java.lang.String parameterSubstitution​(java.lang.String launchCommandStr)
        Scans a string for shortcuts, replacing by the appropriate string. Shortcuts are
        • @P the test command line parameters
        • @S the staging directory
        • @T the test suite directory
        • @t the test case name
        • @R the reporting directory
        A shortcut must be followed by a non-alphabetic character.
        Parameters:
        launchCommandStr - a string describing a command to be run
        Returns:
        the launchCommandStr with shortcuts replaced by the appropriate path/value