Search in sources :

Example 6 with Arguments

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));
}
Also used : Arguments(com.thoughtworks.go.domain.config.Arguments) Test(org.junit.Test)

Example 7 with Arguments

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(""));
}
Also used : Arguments(com.thoughtworks.go.domain.config.Arguments) Test(org.junit.Test)

Example 8 with Arguments

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));
}
Also used : Arguments(com.thoughtworks.go.domain.config.Arguments) Test(org.junit.Test)

Example 9 with Arguments

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())));
}
Also used : Arguments(com.thoughtworks.go.domain.config.Arguments) Test(org.junit.Test)

Example 10 with 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"));
}
Also used : Arguments(com.thoughtworks.go.domain.config.Arguments) Test(org.junit.Test)

Aggregations

Arguments (com.thoughtworks.go.domain.config.Arguments)12 Test (org.junit.Test)12 Argument (com.thoughtworks.go.config.Argument)1 ConfigCache (com.thoughtworks.go.config.ConfigCache)1 ExecTask (com.thoughtworks.go.config.ExecTask)1 MagicalGoConfigXmlLoader (com.thoughtworks.go.config.MagicalGoConfigXmlLoader)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1