Search in sources :

Example 51 with Editor

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

the class ConcourseEditorTest method resourceAttributeHovers.

@Test
public void resourceAttributeHovers() throws Exception {
    Editor editor = harness.newEditor("resources:\n" + "- name: sts4\n" + "  type: git\n" + "  check_every: 5m\n" + "  webhook_token: bladayadayaaa\n" + "  source:\n" + "    repository: https://github.com/spring-projects/sts4\n");
    editor.assertHoverContains("name", "The name of the resource");
    editor.assertHoverContains("type", "The type of the resource. Each worker advertises");
    editor.assertHoverContains("source", 2, "The location of the resource");
    editor.assertHoverContains("webhook_token", "web hooks can be sent to trigger an immediate *check* of the resource");
    editor.assertHoverContains("check_every", "The interval on which to check for new versions");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 52 with Editor

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

the class ConcourseEditorTest method taskInputOptionalAttribute.

@Test
public void taskInputOptionalAttribute() throws Exception {
    Editor editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "platform: linux\n" + "run:\n" + "  path: blah\n" + "inputs:\n" + "- name: foo\n" + "  optional: non-bool\n");
    editor.assertProblems("non-bool|boolean");
    editor.assertHoverContains("optional", "If `true`, then the input is not required by the task");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 53 with Editor

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

the class ConcourseEditorTest method dockerImageResourcePutParamsReconcileAndHovers.

@Test
public void dockerImageResourcePutParamsReconcileAndHovers() throws Exception {
    Editor editor;
    editor = harness.newEditor("resources:\n" + "- name: my-docker-image\n" + "  type: docker-image\n" + "jobs:\n" + "- name: a-job\n" + "  plan:\n" + "  - put: my-docker-image\n" + "    params:\n" + "      build: path/to/docker/dir\n" + "      load: path/to/image\n" + "      dockerfile: path/to/Dockerfile\n" + "      cache: cache-it\n" + "      cache_tag: the-cache-tag\n" + "      load_base: path/to/base-image\n" + "      load_file: path/to/file-to-load\n" + "      load_repository: some-repo\n" + "      load_tag: some-tag\n" + "      import_file: path/to/file-to-import\n" + "      pull_repository: path/to/repository-to-pull\n" + "      pull_tag: tag-to-pull\n" + "      tag: path/to/file-containing-tag\n" + "      tag_prefix: v\n" + "      tag_as_latest: tag-latest\n" + "      build_args: the-build-args\n" + "      build_args_file: path/to/file-with-build-args.json\n" + "    get_params:\n" + "      save: save-it\n" + "      rootfs: tar-it\n" + "      skip_download: skip-it\n");
    editor.assertProblems("cache-it|'boolean'", "pull_repository|Deprecated", "pull_tag|Deprecated", "tag-latest|'boolean'", "the-build-args|Expecting a 'Map'", "save-it|'boolean'", "tar-it|'boolean'", "skip-it|'boolean'");
    assertEquals(DiagnosticSeverity.Warning, editor.assertProblem("pull_repository").getSeverity());
    assertEquals(DiagnosticSeverity.Warning, editor.assertProblem("pull_tag").getSeverity());
    editor.assertHoverContains("build", "directory containing a `Dockerfile`");
    editor.assertHoverContains("load", "directory containing an image");
    editor.assertHoverContains("dockerfile", "path of the `Dockerfile` in the directory");
    editor.assertHoverContains("cache", "first pull `image:tag` from the Docker registry");
    editor.assertHoverContains("cache_tag", "specific tag to pull");
    editor.assertHoverContains("load_base", "path to a directory containing an image to `docker load`");
    editor.assertHoverContains("load_file", "path to a file to `docker load`");
    editor.assertHoverContains("load_repository", "repository of the image loaded from `load_file`");
    editor.assertHoverContains("load_tag", "tag of image loaded from `load_file`");
    editor.assertHoverContains("import_file", "file to `docker import`");
    editor.assertHoverContains("pull_repository", "repository to pull down");
    editor.assertHoverContains("pull_tag", "tag of the repository to pull down");
    // The word 'tag' occurs many times in editor so add use " tag: " to be precise
    editor.assertHoverContains(" tag:", "a path to a file containing the name");
    editor.assertHoverContains("tag_prefix", "prepended with this string");
    editor.assertHoverContains("tag_as_latest", "tagged as `latest`");
    editor.assertHoverContains("build_args", "map of Docker build arguments");
    editor.assertHoverContains("build_args_file", "JSON file containing");
    editor.assertHoverContains("save", "docker save");
    editor.assertHoverContains("rootfs", "a `.tar` file of the image");
    editor.assertHoverContains("skip_download", "Skip `docker pull`");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 54 with Editor

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

the class ConcourseEditorTest method addMultipleRequiredPropertiesQuickfix.

@Test
public void addMultipleRequiredPropertiesQuickfix() throws Exception {
    Editor editor = harness.newEditor("resources:\n" + "- name: foo\n" + "  type: pool\n" + "  source:\n" + "    username: someone\n");
    Diagnostic problem = editor.assertProblems("foo|Unused", "source|[branch, pool, uri] are required").get(1);
    CodeAction quickfix = editor.assertCodeAction(problem);
    assertEquals("Add properties: [branch, pool, uri]", quickfix.getLabel());
    quickfix.perform();
    editor.assertText("resources:\n" + "- name: foo\n" + "  type: pool\n" + "  source:\n" + "    username: someone\n" + "    uri: <*>\n" + "    branch: \n" + "    pool: \n");
}
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 55 with Editor

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

the class ConcourseEditorTest method toplevelCompletions.

@Test
public void toplevelCompletions() throws Exception {
    Editor editor;
    editor = harness.newEditor(CURSOR);
    editor.assertCompletions("groups:\n" + "- name: <*>", // --------------
    "jobs:\n" + "- name: $1\n" + "  plan:\n" + "  - $2<*>", // ---------------
    "resource_types:\n" + "- name: $1\n" + "  type: $2<*>", // ---------------
    "resources:\n" + "- name: $1\n" + "  type: $2<*>");
    editor = harness.newEditor("rety<*>");
    editor.assertCompletions("resource_types:\n" + "- name: $1\n" + "  type: $2<*>");
}
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