Search in sources :

Example 1 with Editor

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

the class BoshEditorTest method relaxedCALessSpaces.

@Test
public void relaxedCALessSpaces() throws Exception {
    Editor editor;
    editor = harness.newEditor("name: \n" + "variables:\n" + "- name: voo\n" + "  type: aaa\n" + "<*>");
    editor.assertContextualCompletions(DEDENTED_COMPLETION.and(SNIPPET_COMPLETION.negate()), "  <*>", // ==>
    "instance_groups:\n" + "- name: $1\n" + "  azs:\n" + "  - $2\n" + "  instances: $3\n" + "  jobs:\n" + "  - name: $4\n" + "    release: $5\n" + "  vm_type: $6\n" + "  stemcell: $7\n" + "  networks:\n" + "  - name: $8<*>", // ----
    "releases:\n" + "- name: $1\n" + "  version: $2<*>", // ----
    "stemcells:\n" + "- alias: $1\n" + "  version: $2<*>", // ---
    "tags:\n" + "  <*>", // ---
    "update:\n" + "  canaries: $1\n" + "  max_in_flight: $2\n" + "  canary_watch_time: $3\n" + "  update_watch_time: $4<*>", // ---
    "- name: <*>");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 2 with Editor

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

the class BoshEditorTest method keyCompletionThatNeedsANewline.

@Test
public void keyCompletionThatNeedsANewline() throws Exception {
    Editor editor = harness.newEditor("name: foo\n" + "update: canwa<*>");
    editor.assertCompletions("name: foo\n" + "update: \n" + "  canary_watch_time: <*>");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 3 with Editor

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

the class BoshEditorTest method cloudconfig_compilation_subproperties.

@Test
public void cloudconfig_compilation_subproperties() throws Exception {
    Editor editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "compilation:\n" + "  <*>");
    editor.assertContextualCompletions(PLAIN_COMPLETION.and(SNIPPET_COMPLETION.negate()), "<*>", "az: <*>", "network: <*>", "reuse_compilation_vms: <*>", "vm_type: <*>", "workers: <*>");
    editor.assertContextualCompletions(PLAIN_COMPLETION.and(SNIPPET_COMPLETION), "<*>", // ==>
    "workers: $1\n" + "  az: $2\n" + "  vm_type: $3\n" + "  network: $4<*>");
    editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "compilation:\n" + "  workers: not-int\n" + "  reuse_compilation_vms: not-bool\n" + "  az: z1\n" + "  vm_type: default\n" + "  network: private\n");
    editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
    editor.assertProblems("not-int|NumberFormatException", "not-bool|unknown 'boolean'", "z1|unknown 'AZName'", "default|unknown 'VMTypeName'", "private|unknown 'NetworkName'");
    editor.assertHoverContains("workers", "The maximum number of compilation VMs");
    editor.assertHoverContains("reuse_compilation_vms", "If `false`, BOSH creates a new compilation VM");
    editor.assertHoverContains("az", "Name of the AZ defined in AZs section");
    editor.assertHoverContains("vm_type", "Name of the VM type defined in VM types section");
    editor.assertHoverContains("network", "References a valid network name defined in the Networks block");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 4 with Editor

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

the class BoshEditorTest method contentAssistAZ.

@Test
public void contentAssistAZ() throws Exception {
    Editor editor = harness.newEditor("name: my-first-deployment\n" + "instance_groups:\n" + "- name: my-server\n" + "  azs:\n" + "  - <*>");
    editor.assertContextualCompletions("<*>", "z1<*>", "z2<*>", "z3<*>");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 5 with Editor

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

the class BoshEditorTest method releasesAdvancedValidations.

@Test
public void releasesAdvancedValidations() throws Exception {
    Editor editor = harness.newEditor("releases:\n" + "- name: some-release\n" + "  url: https://my.releases.com/funky.tar.gz\n" + "- name: other-relase\n" + "  version: other-version\n" + "  url: file:///root/releases/a-nice-file.tar.gz\n" + "- name: bad-url\n" + "  version: more-version\n" + "  url: proto://something.com\n" + "#x");
    editor.assertProblems("^-^ name: some-release|'version' is required", "url|'sha1' is recommended when the 'url' is http(s)", "proto|Url scheme must be one of [http, https, file]", "x|are required");
    Diagnostic missingSha1Problem = editor.assertProblem("url");
    assertContains("'sha1' is recommended", missingSha1Problem.getMessage());
    assertEquals(DiagnosticSeverity.Warning, missingSha1Problem.getSeverity());
}
Also used : Diagnostic(org.eclipse.lsp4j.Diagnostic) 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