示例#1
0
  /**
   * Resolves nothing.
   *
   * @throws Exception if failed
   */
  @Test
  public void resolve_nothing() throws Exception {
    CommandScript script =
        new CommandScript(
            "testing",
            set("blk1", "blk2"),
            "profile",
            "module",
            Arrays.asList("cmd1", "cmd2"),
            map("ASAKUSA_HOME", folder.getRoot().getAbsolutePath()));

    ExecutionContext context =
        new ExecutionContext("b", "f", "e", ExecutionPhase.MAIN, map("arg", "ARG"));
    CommandScript resolved = script.resolve(context, handler());
    assertThat(resolved.isResolved(), is(true));
    assertThat(resolved, is(script));
  }
示例#2
0
  /**
   * Resolves something.
   *
   * @throws Exception if failed
   */
  @Test
  public void resolve() throws Exception {
    CommandScript script =
        new CommandScript(
            "testing",
            set("blk1", "blk2"),
            "profile",
            "module",
            Arrays.asList(
                ExecutionScript.PLACEHOLDER_HOME + "/cmd1",
                ExecutionScript.PLACEHOLDER_EXECUTION_ID,
                ExecutionScript.PLACEHOLDER_ARGUMENTS),
            map("ASAKUSA_HOME", ExecutionScript.PLACEHOLDER_HOME));

    ExecutionContext context =
        new ExecutionContext("b", "f", "e", ExecutionPhase.MAIN, map("arg", "ARG"));
    CommandScript resolved =
        script.resolve(
            context, handler(ExecutionScriptHandler.KEY_ENV_PREFIX + "ASAKUSA_HOME", "ah"));
    assertThat(resolved.isResolved(), is(true));
    assertThat(
        resolved.getCommandLineTokens(),
        is(Arrays.asList("ah/cmd1", "e", context.getArgumentsAsString())));
    assertThat(resolved.getEnvironmentVariables().size(), is(1));
    assertThat(resolved.getEnvironmentVariables().get("ASAKUSA_HOME"), is("ah"));
  }
示例#3
0
 /** Simple testing. */
 @Test
 public void simple() {
   CommandScript script =
       new CommandScript(
           "testing",
           set("blk1", "blk2"),
           "profile",
           "module",
           Arrays.asList("cmd1", "cmd2"),
           map("ASAKUSA_HOME", folder.getRoot().getAbsolutePath()));
   assertThat(script.getKind(), is(ExecutionScript.Kind.COMMAND));
   assertThat(script.getId(), is("testing"));
   assertThat(script.getBlockerIds(), is(set("blk1", "blk2")));
   assertThat(script.getProfileName(), is("profile"));
   assertThat(script.getModuleName(), is("module"));
   assertThat(script.getCommandLineTokens(), is(Arrays.asList("cmd1", "cmd2")));
   assertThat(script.getEnvironmentVariables().size(), is(1));
   assertThat(
       script.getEnvironmentVariables().get("ASAKUSA_HOME"),
       is(folder.getRoot().getAbsolutePath()));
 }