Search in sources :

Example 41 with Editor

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

the class ConcourseEditorTest method taskStepHovers.

@Test
public void taskStepHovers() throws Exception {
    Editor editor = harness.newEditor("jobs:\n" + "- name: some-job\n" + "  plan:\n" + "  - task: do-something\n" + "    file: some-file.yml\n" + "    privileged: true\n" + "    image: some-image\n" + "    params:\n" + "      map: of-stuff\n" + "    input_mapping:\n" + "      map: of-stuff\n" + "    output_mapping:\n" + "      map: of-stuff\n" + "    config: some-config\n" + "    tags: [a, b, c]\n" + "    attempts: 10\n" + "    timeout: 1h30m\n" + "    ensure:\n" + "      bogus: bad\n" + "    on_failure:\n" + "      bogus: bad\n" + "    on_success:\n" + "      bogus: bad\n");
    editor.assertHoverContains("file", "`file` points at a `.yml` file containing the task config");
    editor.assertHoverContains("privileged", "If set to `true`, the task will run with full capabilities");
    editor.assertHoverContains("image", "Names an artifact source within the plan");
    editor.assertHoverContains("params", "A map of task parameters to set, overriding those configured in `config` or `file`");
    editor.assertHoverContains("input_mapping", "A map from task input names to concrete names in the build plan");
    editor.assertHoverContains("output_mapping", "A map from task output names to concrete names");
    editor.assertHoverContains("config", "Use `config` to inline the task config");
    editor.assertHoverContains("tags", "Any step can be directed at a pool of workers");
    editor.assertHoverContains("timeout", "amount of time to limit the step's execution");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 42 with Editor

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

the class ConcourseEditorTest method reconcileTaskFileToplevelProperties.

@Test
public void reconcileTaskFileToplevelProperties() throws Exception {
    Editor editor;
    editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "rootfs_uri: some-image");
    editor.assertProblems("rootfs_uri: some-imag^e^|[platform, run] are required");
    editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "platform: a-platform\n" + "image_resource:\n" + "  name: should-not-be-here\n" + "  type: docker-image\n" + "  source:\n" + "    bogus-source-prop: bad\n" + "    repository: ruby\n" + "    tag: '2.1'\n" + "rootfs_uri: some-image\n" + "inputs:\n" + "- path: path/to/input\n" + "outputs:\n" + "- path: path/to/output\n" + "run:\n" + "  path: my-app/scripts/test\n" + "params: the-params\n");
    editor.assertProblems("image_resource|Only one of [image_resource, rootfs_uri, image] should be defined", "name|Unknown property", "bogus-source-prop|Unknown property", "rootfs_uri|Only one of [image_resource, rootfs_uri, image] should be defined", "-^ path: path/to/input|'name' is required", "-^ path: path/to/output|'name' is required", "the-params|Expecting a 'Map'");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 43 with Editor

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

the class ConcourseEditorTest method relaxedIndentContextMoreSpaces3.

@Test
public void relaxedIndentContextMoreSpaces3() throws Exception {
    Editor editor = harness.newEditor("jobs:\n" + "- name: job-hello-world\n" + "  public: true\n" + "  plan:\n" + "  - get: resource-tutorial\n" + "  - task: hello-world\n" + "  <*>");
    editor.assertCompletionLabels(// completions for current (i.e Job) context:
    "build_logs_to_retain", "disable_manual_trigger", "ensure", "interruptible", "max_in_flight", "on_failure", "on_success", "serial", "serial_groups", // Completions for nested context (i.e. task step)
    "→ attempts", "→ config", "→ ensure", "→ file", "→ image", "→ input_mapping", "→ on_failure", "→ on_success", "→ output_mapping", "→ params", "→ privileged", "→ tags", "→ timeout", // Completions with '-'
    "- aggregate", "- do", "- get", "- put", "- task", "- try", // Dedented completions
    "← groups", "← resource_types", "← resources", "← - Job Snippet", "← - name");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 44 with Editor

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

the class ConcourseEditorTest method PT_141050891_language_server_crashes_on_CA_before_first_document_marker.

@Test
public void PT_141050891_language_server_crashes_on_CA_before_first_document_marker() throws Exception {
    Editor editor = harness.newEditor("%Y<*>\n" + "#leading comment\n" + "---\n" + "resources:\n" + "- name: my-repo\n" + "  type: git\n" + "  source:\n" + "    uri: https://github.com/spring-projects/sts4.git\n" + "    <*>");
    // We don't expect completions, but this should at least not crash!
    editor.assertCompletions();
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 45 with Editor

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

the class ConcourseEditorTest method cfPutParamsHovers.

@Test
public void cfPutParamsHovers() throws Exception {
    Editor editor = harness.newEditor("resources:\n" + "- name: pws\n" + "  type: cf\n" + "jobs:\n" + "- name: deploy-stuff\n" + "  plan:\n" + "  - put: pws\n" + "    params:\n" + "      manifest: repo/manifest.yml\n" + "      path: out/*.jar\n" + "      current_app_name: the-name\n" + "      environment_variables:\n" + "        key: value\n" + "        key2: value2\n");
    editor.assertHoverContains("manifest", "Path to a application manifest file");
    editor.assertHoverContains("path", "Path to the application to push");
    editor.assertHoverContains("current_app_name", "zero-downtime deploy");
    editor.assertHoverContains("environment_variables", "Environment variables");
}
Also used : 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