use of com.thoughtworks.go.domain.config.Arguments in project gocd by gocd.
the class ExecTaskTest method shouldBeValid.
@Test
public void shouldBeValid() throws Exception {
ExecTask execTask = new ExecTask("", new Arguments(new Argument("arg1"), new Argument("arg2")));
execTask.validate(ConfigSaveValidationContext.forChain(new BasicCruiseConfig()));
assertThat(execTask.errors().isEmpty(), is(true));
execTask = new ExecTask("command", "", "blah");
execTask.validate(ConfigSaveValidationContext.forChain(new BasicCruiseConfig()));
assertThat(execTask.errors().isEmpty(), is(true));
}
use of com.thoughtworks.go.domain.config.Arguments in project gocd by gocd.
the class ExecTaskTest method shouldReturnEmptyCommandArguments.
@Test
public void shouldReturnEmptyCommandArguments() {
ExecTask task = new ExecTask("./bn", new Arguments(), "src/build");
assertThat(task.arguments(), is(""));
}
use of com.thoughtworks.go.domain.config.Arguments in project gocd by gocd.
the class ExecTaskTest method shouldValidateConfig.
@Test
public void shouldValidateConfig() throws Exception {
ExecTask execTask = new ExecTask("arg1 arg2", new Arguments(new Argument("arg1"), new Argument("arg2")));
execTask.validate(ConfigSaveValidationContext.forChain(new BasicCruiseConfig()));
assertThat(execTask.errors().isEmpty(), is(false));
assertThat(execTask.errors().on(ExecTask.ARGS), is(ExecTask.EXEC_CONFIG_ERROR));
assertThat(execTask.errors().on(ExecTask.ARG_LIST_STRING), is(ExecTask.EXEC_CONFIG_ERROR));
}
use of com.thoughtworks.go.domain.config.Arguments in project gocd by gocd.
the class ExecTaskTest method shouldUnEqualIfOtherTaskCommandIsNull.
@Test
public void shouldUnEqualIfOtherTaskCommandIsNull() {
ExecTask task = new ExecTask("ls", new Arguments());
assertFalse(task.equals(new ExecTask(null, new Arguments())));
}
use of com.thoughtworks.go.domain.config.Arguments in project gocd by gocd.
the class ExecTaskTest method shouldAddErrorsOfEachArgumentToTheParent.
@Test
public void shouldAddErrorsOfEachArgumentToTheParent() {
Argument argument = new Argument("invalid-argument");
argument.addError(ExecTask.ARG_LIST_STRING, "Invalid argument");
ExecTask execTask = new ExecTask("echo", new Arguments(argument), null);
execTask.validate(ConfigSaveValidationContext.forChain(new BasicCruiseConfig()));
assertThat(execTask.errors().on(ExecTask.ARG_LIST_STRING), is("Invalid argument"));
}
Aggregations