Search in sources :

Example 1 with Command

use of org.eclipse.che.api.workspace.server.wsplugins.model.Command in project devspaces-images by redhat-developer.

the class KubernetesPluginsToolingApplierTest method shouldProvisionPluginsCommandsToEnvironment.

@Test
public void shouldProvisionPluginsCommandsToEnvironment() throws Exception {
    // given
    Command pluginCommand = new Command().name("test-command").workingDir("~").command(Arrays.asList("./build.sh", "--no-pull"));
    // when
    applier.apply(runtimeIdentity, internalEnvironment, singletonList(createChePlugin(createContainer("container", pluginCommand))));
    // then
    List<CommandImpl> envCommands = internalEnvironment.getCommands();
    assertEquals(envCommands.size(), 1);
    CommandImpl envCommand = envCommands.get(0);
    assertEquals(envCommand.getName(), pluginCommand.getName());
    assertEquals(envCommand.getCommandLine(), String.join(" ", pluginCommand.getCommand()));
    assertEquals(envCommand.getType(), "custom");
    assertEquals(envCommand.getAttributes().get(WORKING_DIRECTORY_ATTRIBUTE), pluginCommand.getWorkingDir());
    validateContainerNameName(envCommand.getAttributes().get(MACHINE_NAME_ATTRIBUTE), "container");
}
Also used : CommandImpl(org.eclipse.che.api.workspace.server.model.impl.CommandImpl) Command(org.eclipse.che.api.workspace.server.wsplugins.model.Command) Test(org.testng.annotations.Test)

Example 2 with Command

use of org.eclipse.che.api.workspace.server.wsplugins.model.Command in project che-server by eclipse-che.

the class KubernetesPluginsToolingApplierTest method shouldProvisionPluginsCommandsToEnvironment.

@Test
public void shouldProvisionPluginsCommandsToEnvironment() throws Exception {
    // given
    Command pluginCommand = new Command().name("test-command").workingDir("~").command(Arrays.asList("./build.sh", "--no-pull"));
    // when
    applier.apply(runtimeIdentity, internalEnvironment, singletonList(createChePlugin(createContainer("container", pluginCommand))));
    // then
    List<CommandImpl> envCommands = internalEnvironment.getCommands();
    assertEquals(envCommands.size(), 1);
    CommandImpl envCommand = envCommands.get(0);
    assertEquals(envCommand.getName(), pluginCommand.getName());
    assertEquals(envCommand.getCommandLine(), String.join(" ", pluginCommand.getCommand()));
    assertEquals(envCommand.getType(), "custom");
    assertEquals(envCommand.getAttributes().get(WORKING_DIRECTORY_ATTRIBUTE), pluginCommand.getWorkingDir());
    validateContainerNameName(envCommand.getAttributes().get(MACHINE_NAME_ATTRIBUTE), "container");
}
Also used : CommandImpl(org.eclipse.che.api.workspace.server.model.impl.CommandImpl) Command(org.eclipse.che.api.workspace.server.wsplugins.model.Command) Test(org.testng.annotations.Test)

Aggregations

CommandImpl (org.eclipse.che.api.workspace.server.model.impl.CommandImpl)2 Command (org.eclipse.che.api.workspace.server.wsplugins.model.Command)2 Test (org.testng.annotations.Test)2