Search in sources :

Example 1 with ExternalCommand

use of org.springframework.ide.vscode.commons.util.ExternalCommand in project sts4 by spring-projects.

the class BoshCommandStemcellsProviderTest method obeysCliConfigTarget.

@Test
public void obeysCliConfigTarget() throws Exception {
    JsonElement settings = settings(ImmutableMap.of("bosh", ImmutableMap.of("cli", ImmutableMap.of("command", "alternate-command", "target", "explicit-target"))));
    cliConfig.handleConfigurationChange(new Settings(settings));
    assertEquals(ImmutableList.of(new StemcellData("bosh-vsphere-esxi-centos-7-go_agent", "3421.11", "centos-7"), new StemcellData("bosh-vsphere-esxi-ubuntu-trusty-go_agent", "3421.11", "ubuntu-trusty")), provider.getModel(mock(DynamicSchemaContext.class)).getStemcells());
    verify(provider).executeCommand(eq(new ExternalCommand("alternate-command", "-e", "explicit-target", "stemcells", "--json")));
}
Also used : ExternalCommand(org.springframework.ide.vscode.commons.util.ExternalCommand) JsonElement(com.google.gson.JsonElement) DynamicSchemaContext(org.springframework.ide.vscode.commons.yaml.schema.DynamicSchemaContext) Settings(org.springframework.ide.vscode.commons.languageserver.util.Settings) Test(org.junit.Test)

Example 2 with ExternalCommand

use of org.springframework.ide.vscode.commons.util.ExternalCommand in project sts4 by spring-projects.

the class MavenBuilder method execute.

public void execute() throws IOException, InterruptedException, TimeoutException {
    Path mvnwPath = System.getProperty("os.name").toLowerCase().startsWith("win") ? projectPath.resolve("mvnw.cmd") : projectPath.resolve("mvnw");
    mvnwPath.toFile().setExecutable(true);
    List<String> all = new ArrayList<>(1 + targets.size() + properties.size());
    all.add(mvnwPath.toAbsolutePath().toString());
    all.addAll(targets);
    all.addAll(properties);
    ExternalProcess process = new ExternalProcess(projectPath.toFile(), new ExternalCommand(all.toArray(new String[all.size()])), true);
    if (process.getExitValue() != 0) {
        throw new RuntimeException("Failed to build test project! " + process);
    }
}
Also used : Path(java.nio.file.Path) ExternalCommand(org.springframework.ide.vscode.commons.util.ExternalCommand) ArrayList(java.util.ArrayList) ExternalProcess(org.springframework.ide.vscode.commons.util.ExternalProcess)

Example 3 with ExternalCommand

use of org.springframework.ide.vscode.commons.util.ExternalCommand in project sts4 by spring-projects.

the class BoshCommandStemcellsProviderTest method obeysCliConfigCommandAndTarget.

// @Test public void defaultCliConfig() throws Exception {
// assertEquals(ImmutableList.of(
// new StemcellData("bosh-vsphere-esxi-centos-7-go_agent", "3421.11", "centos-7"),
// new StemcellData("bosh-vsphere-esxi-ubuntu-trusty-go_agent", "3421.11", "ubuntu-trusty")
// ),
// provider.getModel(mock(DynamicSchemaContext.class)).getStemcells()
// );
// verify(provider).executeCommand(eq(new ExternalCommand("bosh", "stemcells", "--json")));
// }
@Test
public void obeysCliConfigCommandAndTarget() throws Exception {
    JsonElement settings = settings(ImmutableMap.of("bosh", ImmutableMap.of("cli", ImmutableMap.of("command", "alternate-command", "target", "some-target"))));
    cliConfig.handleConfigurationChange(new Settings(settings));
    assertEquals(ImmutableList.of(new StemcellData("bosh-vsphere-esxi-centos-7-go_agent", "3421.11", "centos-7"), new StemcellData("bosh-vsphere-esxi-ubuntu-trusty-go_agent", "3421.11", "ubuntu-trusty")), provider.getModel(mock(DynamicSchemaContext.class)).getStemcells());
    verify(provider).executeCommand(eq(new ExternalCommand("alternate-command", "-e", "some-target", "stemcells", "--json")));
}
Also used : ExternalCommand(org.springframework.ide.vscode.commons.util.ExternalCommand) JsonElement(com.google.gson.JsonElement) DynamicSchemaContext(org.springframework.ide.vscode.commons.yaml.schema.DynamicSchemaContext) Settings(org.springframework.ide.vscode.commons.languageserver.util.Settings) Test(org.junit.Test)

Aggregations

ExternalCommand (org.springframework.ide.vscode.commons.util.ExternalCommand)3 JsonElement (com.google.gson.JsonElement)2 Test (org.junit.Test)2 Settings (org.springframework.ide.vscode.commons.languageserver.util.Settings)2 DynamicSchemaContext (org.springframework.ide.vscode.commons.yaml.schema.DynamicSchemaContext)2 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 ExternalProcess (org.springframework.ide.vscode.commons.util.ExternalProcess)1