Search in sources :

Example 1 with Arguments

use of com.thoughtworks.go.domain.config.Arguments in project gocd by gocd.

the class ExecTaskTest method shouldSupportMultipleArgs.

@Test
public void shouldSupportMultipleArgs() throws Exception {
    String xml = "<exec command='ls'>\n" + "  <arg>arg1</arg>\n" + "  <arg>arg2</arg>\n" + "</exec>";
    ExecTask execTask = new MagicalGoConfigXmlLoader(new ConfigCache(), ConfigElementImplementationRegistryMother.withNoPlugins()).fromXmlPartial(xml, ExecTask.class);
    assertThat(execTask.getArgList(), is(new Arguments(new Argument("arg1"), new Argument("arg2"))));
}
Also used : ConfigCache(com.thoughtworks.go.config.ConfigCache) Argument(com.thoughtworks.go.config.Argument) ExecTask(com.thoughtworks.go.config.ExecTask) Arguments(com.thoughtworks.go.domain.config.Arguments) MagicalGoConfigXmlLoader(com.thoughtworks.go.config.MagicalGoConfigXmlLoader) StringContains.containsString(org.hamcrest.core.StringContains.containsString) Test(org.junit.Test)

Example 2 with Arguments

use of com.thoughtworks.go.domain.config.Arguments in project gocd by gocd.

the class ExecTaskTest method shouldUnEqualIfCommandsDontMatch.

@Test
public void shouldUnEqualIfCommandsDontMatch() {
    ExecTask task = new ExecTask("ls", new Arguments());
    assertFalse(task.equals(new ExecTask("rm", new Arguments())));
}
Also used : Arguments(com.thoughtworks.go.domain.config.Arguments) Test(org.junit.Test)

Example 3 with Arguments

use of com.thoughtworks.go.domain.config.Arguments in project gocd by gocd.

the class ExecTaskTest method describeMutipleArgumentsTest.

@Test
public void describeMutipleArgumentsTest() {
    ExecTask task = new ExecTask("echo", null, new Arguments(new Argument("abc"), new Argument("hello baby!")));
    task.setTimeout(600);
    assertThat(task.describe(), Is.is("echo abc \"hello baby!\""));
}
Also used : Arguments(com.thoughtworks.go.domain.config.Arguments) Test(org.junit.Test)

Example 4 with Arguments

use of com.thoughtworks.go.domain.config.Arguments in project gocd by gocd.

the class ExecTaskTest method shouldUnEqualIfCommandIsNull.

@Test
public void shouldUnEqualIfCommandIsNull() {
    ExecTask task = new ExecTask(null, new Arguments());
    assertFalse(task.equals(new ExecTask("rm", new Arguments())));
}
Also used : Arguments(com.thoughtworks.go.domain.config.Arguments) Test(org.junit.Test)

Example 5 with Arguments

use of com.thoughtworks.go.domain.config.Arguments in project gocd by gocd.

the class ExecTaskTest method shouldReturnCommandArgumentList.

@Test
public void shouldReturnCommandArgumentList() {
    ExecTask task = new ExecTask("./bn", new Arguments(new Argument("clean"), new Argument("compile"), new Argument("\"buildfile\"")), "src/build");
    assertThat(task.arguments(), is("clean compile \"buildfile\""));
}
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