Ejemplo n.º 1
0
  @Before
  public void setUp() throws IOException, JAXBException {
    /* Delete the export directory and everything in it */
    FileUtils.deleteDirectory(new File(EXPORT_DIR));

    /* Mock the alert boxes in ScenarioEditor in the case of an error (unexpected) so Jenkins doesn't freeze */
    ScenarioEditor.setOptionPrompt(OptionPromptHelper.getYesOptionPrompt());

    configuration = BW4TClientConfig.fromXML(CONFIG_PATH);

    /*
     * Nasty hack time:
     * The exporter supports loading an existing GOAL file and copying it to the directory.
     * To test this is a challenge since paths aren't equal across computers.
     *
     * The solution is to copy the robot.goal file to the working directory, thus making it available for loading
     * during the test, and in the test breakdown to delete it.
     */
    FileUtils.copyFile(new File(AGENT_GOAL_FILE), new File(AGENT_GOAL_FILE_WORKING));

    // The actual export.
    ExportToMAS.export(EXPORT_DIR, configuration, CONFIG_NAME);
  }