Search in sources :

Example 31 with Editor

use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.

the class BoshEditorTest method variablesBlockCompletions.

@Test
public void variablesBlockCompletions() throws Exception {
    harness.getServerWrapper().enableSnippets(false);
    Editor editor = harness.newEditor("variables:\n" + "- <*>");
    editor.assertCompletions("variables:\n" + "- name: <*>");
    editor = harness.newEditor("variables:\n" + "- name: foo\n" + "  <*>");
    editor.assertCompletions(PLAIN_COMPLETION, "variables:\n" + "- name: foo\n" + "  options:\n" + "    <*>", // ===============
    "variables:\n" + "- name: foo\n" + "  type: <*>");
    editor = harness.newEditor("variables:\n" + "- name: foo\n" + "  type: <*>");
    editor.assertCompletionLabels("certificate", "password", "rsa", "ssh");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 32 with Editor

use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.

the class BoshEditorTest method missingPropertiesQuickfix.

@Test
public void missingPropertiesQuickfix() throws Exception {
    Editor editor = harness.newEditor("name: blah\n" + "stemcells:\n" + "- alias: ubuntu\n" + "  os: ubuntu-trusty\n" + "  version: 3421.11\n" + "- alias: centos\n" + "  os: centos-7\n" + "  version: latest");
    Diagnostic problem = editor.assertProblems("t|Properties [instance_groups, releases, update] are required").get(0);
    CodeAction quickfix = editor.assertCodeAction(problem);
    assertEquals("Add properties: [instance_groups, releases, update]", quickfix.getLabel());
    quickfix.perform();
    editor.assertText("name: blah\n" + "stemcells:\n" + "- alias: ubuntu\n" + "  os: ubuntu-trusty\n" + "  version: 3421.11\n" + "- alias: centos\n" + "  os: centos-7\n" + "  version: latest\n" + "releases:\n" + "- name: <*>\n" + "  version: \n" + "update:\n" + "  canaries: \n" + "  max_in_flight: \n" + "  canary_watch_time: \n" + "  update_watch_time: \n" + "instance_groups:\n" + "- name: \n" + "  azs:\n" + "  - \n" + "  instances: \n" + "  jobs:\n" + "  - name: \n" + "    release: \n" + "  vm_type: \n" + "  stemcell: \n" + "  networks:\n" + "  - name: ");
}
Also used : CodeAction(org.springframework.ide.vscode.languageserver.testharness.CodeAction) Diagnostic(org.eclipse.lsp4j.Diagnostic) Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 33 with Editor

use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.

the class BoshEditorTest method stemcellCompletions.

@Test
public void stemcellCompletions() throws Exception {
    Editor editor = harness.newEditor("stemcells:\n" + "- <*>");
    editor.assertCompletions(PLAIN_COMPLETION, "stemcells:\n" + "- alias: $1\n" + "  version: $2<*>", // ==========
    "stemcells:\n" + "- alias: <*>");
    editor = harness.newEditor("stemcells:\n" + "- alias: blah\n" + "  <*>");
    editor.assertContextualCompletions(PLAIN_COMPLETION, "<*>", // =>
    "name: <*>", "os: <*>", "version: <*>");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 34 with Editor

use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.

the class BoshEditorTest method contentAssistReleaseVersion.

@Test
public void contentAssistReleaseVersion() throws Exception {
    releasesProvider = provideReleasesFrom(new ReleaseData("foo", "123.4"), new ReleaseData("foo", "222.2"), new ReleaseData("bar", "222.2"), new ReleaseData("bar", "333.3"));
    Editor editor = harness.newEditor("releases:\n" + "- version: <*>");
    editor.assertContextualCompletions("<*>", "123.4<*>", "222.2<*>", "333.3<*>", "latest<*>");
    editor = harness.newEditor("releases:\n" + "- name: foo\n" + "  version: <*>");
    editor.assertContextualCompletions("<*>", "123.4<*>", "222.2<*>", "latest<*>");
    // Still get all suggestions even when 'url' property is added
    editor = harness.newEditor("releases:\n" + "- version: <*>\n" + "  url: blah");
    editor.assertContextualCompletions("<*>", "123.4<*>", "222.2<*>", "333.3<*>", "latest<*>");
    editor = harness.newEditor("releases:\n" + "- name: foo\n" + "  url: blah\n" + "  version: <*>");
    editor.assertContextualCompletions("<*>", "123.4<*>", "222.2<*>", "333.3<*>", "latest<*>");
}
Also used : ReleaseData(org.springframework.ide.vscode.bosh.models.ReleaseData) Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 35 with Editor

use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.

the class BoshEditorTest method reconcileCfManifest.

@Test
public void reconcileCfManifest() throws Exception {
    cloudConfigProvider.executeCommandWith(() -> {
        throw new IOException("Couldn't contact the director");
    });
    Editor editor = harness.newEditorFromClasspath("/workspace/cf-deployment-manifest.yml");
    editor.assertProblems();
}
Also used : IOException(java.io.IOException) Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Aggregations

Editor (org.springframework.ide.vscode.languageserver.testharness.Editor)402 Test (org.junit.Test)385 AbstractPropsEditorTest (org.springframework.ide.vscode.boot.editor.harness.AbstractPropsEditorTest)81 LiveBeansModel (org.springframework.ide.vscode.commons.boot.app.cli.livebean.LiveBeansModel)29 File (java.io.File)27 IJavaProject (org.springframework.ide.vscode.commons.java.IJavaProject)24 Diagnostic (org.eclipse.lsp4j.Diagnostic)22 Ignore (org.junit.Ignore)15 CompletionItem (org.eclipse.lsp4j.CompletionItem)13 IOException (java.io.IOException)9 CFDomain (org.springframework.ide.vscode.commons.cloudfoundry.client.CFDomain)6 ClientRequests (org.springframework.ide.vscode.commons.cloudfoundry.client.ClientRequests)6 CodeAction (org.springframework.ide.vscode.languageserver.testharness.CodeAction)5 ReleaseData (org.springframework.ide.vscode.bosh.models.ReleaseData)4 CFServiceInstance (org.springframework.ide.vscode.commons.cloudfoundry.client.CFServiceInstance)4 DynamicModelProvider (org.springframework.ide.vscode.bosh.models.DynamicModelProvider)3 NoTargetsException (org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.NoTargetsException)3 InputStream (java.io.InputStream)2 TimeoutException (java.util.concurrent.TimeoutException)2 StemcellData (org.springframework.ide.vscode.bosh.models.StemcellData)2