Search in sources :

Example 61 with Editor

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

the class ConcourseEditorTest method noListIndent.

@Test
public void noListIndent() throws Exception {
    Editor editor;
    editor = harness.newEditor("jo<*>");
    editor.assertCompletions("jobs:\n" + "- name: $1\n" + "  plan:\n" + "  - $2<*>");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 62 with Editor

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

the class ConcourseEditorTest method reconcilerJobFromPassedAttributeMustInteractWithResource.

@Test
public void reconcilerJobFromPassedAttributeMustInteractWithResource() throws Exception {
    Editor editor;
    editor = harness.newEditor("resources:\n" + "- name: version\n" + "  type: semver\n" + "- name: source-repo\n" + "  type: git\n" + "jobs:\n" + "- name: build-it\n" + "  plan:\n" + "  - aggregate:\n" + "    # - put: version\n" + "    - get: source-repo\n" + "- name: test-it\n" + "  plan:\n" + "  - get: source-repo\n" + "    passed:\n" + "    - build-it # <- good\n" + "  - get: version\n" + "    passed:\n" + "    - build-it # <- bad\n");
    editor.assertProblems("build-it^ # <- bad|Job 'build-it' does not interact with resource 'version'");
    editor = harness.newEditor("resources:\n" + "- name: version\n" + "  type: semver\n" + "- name: source-repo\n" + "  type: git\n" + "jobs:\n" + "- name: build-it\n" + "  plan:\n" + "  - aggregate:\n" + "    - put: version\n" + "    # - get: source-repo\n" + "- name: test-it\n" + "  plan:\n" + "  - get: source-repo\n" + "    passed:\n" + "    - build-it # <- bad\n" + "  - get: version\n" + "    passed:\n" + "    - build-it # <- good\n");
    editor.assertProblems("build-it^ # <- bad|Job 'build-it' does not interact with resource 'source-repo'");
    // Check that we find interactions in steps that are at the top-level of the plan:
    editor = harness.newEditor("resources:\n" + "- name: version\n" + "  type: semver\n" + "- name: source-repo\n" + "  type: git\n" + "jobs:\n" + "- name: build-it\n" + "  plan:\n" + "  - aggregate:\n" + "    - put: version\n" + "    - get: source-repo\n" + "- name: test-it\n" + "  plan:\n" + "  - get: source-repo\n" + "    passed:\n" + "    - build-it\n" + "  - get: version\n" + "    passed:\n" + "    - build-it\n");
    editor.assertProblems();
    // Check that we find interactions in steps that are nested in other steps
    editor = harness.newEditor("resources:\n" + "- name: version\n" + "  type: semver\n" + "- name: source-repo\n" + "  type: git\n" + "jobs:\n" + "- name: build-it\n" + "  plan:\n" + "  - put: version\n" + "  - get: source-repo\n" + "- name: test-it\n" + "  plan:\n" + "  - get: source-repo\n" + "    passed:\n" + "    - build-it\n" + "  - get: version\n" + "    passed:\n" + "    - build-it\n");
    editor.assertProblems();
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 63 with Editor

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

the class ConcourseEditorTest method s3ResourcePutParamsReconcileAndHovers.

@Test
public void s3ResourcePutParamsReconcileAndHovers() throws Exception {
    Editor editor;
    editor = harness.newEditor("resources:\n" + "- name: my-s3-bucket\n" + "  type: s3\n" + "jobs:\n" + "- name: a-job\n" + "  plan:\n" + "  - put: my-s3-bucket\n" + "    params:\n" + "      acl: public-read\n" + "    get_params:\n" + "      no-params-expected: bad");
    editor.assertProblems("params|'file' is required", "no-params-expected|Unknown property");
    editor = harness.newEditor("resources:\n" + "- name: my-s3-bucket\n" + "  type: s3\n" + "jobs:\n" + "- name: a-job\n" + "  plan:\n" + "  - put: my-s3-bucket\n" + "    params:\n" + "      file: path/to/file\n" + "      acl: bad-acl\n" + "      content_type: anything/goes\n");
    editor.assertProblems("bad-acl|unknown 'S3CannedAcl'");
    editor.assertHoverContains("file", "Path to the file to upload");
    editor.assertHoverContains("acl", "Canned Acl");
    editor.assertHoverContains("content_type", "MIME");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 64 with Editor

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

the class ConcourseEditorTest method taskCachesHovers.

@Test
public void taskCachesHovers() throws Exception {
    Editor editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "platform: linux\n" + "\n" + "inputs:\n" + "- name: project-src\n" + "\n" + "caches:\n" + "- path: project-src/node_modules\n" + "  junk: bad\n" + "\n" + "run:\n" + "  path: project-src/ci/build");
    editor.assertHoverContains("caches", "Caches are scoped to the worker the task is run on");
    editor.assertHoverContains("path", "The path to a directory to be cached");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 65 with Editor

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

the class ConcourseEditorTest method gotoSymbolInPipeline.

@Test
public void gotoSymbolInPipeline() throws Exception {
    Editor editor = harness.newEditor("resource_types:\n" + "- name: some-resource-type\n" + "resources:\n" + "- name: foo-resource\n" + "- name: bar-resource\n" + "jobs:\n" + "- name: do-some-stuff\n" + "- name: do-more-stuff\n" + "groups:\n" + "- name: group-one\n" + "- name: group-two\n");
    editor.assertDocumentSymbols("some-resource-type|ResourceType", "foo-resource|Resource", "bar-resource|Resource", "do-some-stuff|Job", "do-more-stuff|Job", "group-one|Group", "group-two|Group");
}
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