Search in sources :

Example 46 with Editor

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

the class ConcourseEditorTest method reconcileUnusedResources.

@Test
public void reconcileUnusedResources() 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" + "  - get: version\n");
    Diagnostic p = editor.assertProblems("source-repo|Unused 'Resource'").get(0);
    assertEquals(DiagnosticSeverity.Error, p.getSeverity());
    editor = harness.newEditor("resources:\n" + "- name: not-used\n" + "  type: pool\n" + "- name: version\n" + "  type: semver\n" + "- name: source-repo\n" + "  type: git\n" + "  source:\n" + "    branch: master\n" + "    uri: git@someplace.com:blah/blah.git\n" + "jobs:\n" + "- name: build-it\n" + "  plan:\n" + "  - aggregate:\n" + // <-- This isn't a real use but looks like one!
    "    - get: not-used\n" + "      resource: version\n" + "    - put: source-repo\n");
    editor.assertProblems("not-used|Unused 'Resource'");
}
Also used : Diagnostic(org.eclipse.lsp4j.Diagnostic) Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 47 with Editor

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

the class ConcourseEditorTest method poolResourceGetParamsReconcileAndHovers.

@Test
public void poolResourceGetParamsReconcileAndHovers() throws Exception {
    Editor editor;
    editor = harness.newEditor("resources:\n" + "- name: my-locks\n" + "  type: pool\n" + "jobs:\n" + "- name: a-job\n" + "  plan:\n" + "  - get: my-locks\n" + "    params:\n" + "      no-params-expected: bad");
    editor.assertProblems("no-params-expected|Unknown property");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 48 with Editor

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

the class ConcourseEditorTest method taskRunPropertiesValidationAndHovers.

@Test
public void taskRunPropertiesValidationAndHovers() throws Exception {
    Editor editor;
    editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "inputs:\n" + "- name: sts4\n" + "outputs:\n" + "- name: vsix-files\n" + "platform: linux\n" + "image_resource:\n" + "  type: docker-image\n" + "  source:\n" + "    repository: kdvolder/sts4-build-env\n" + "run:\n" + "  path: sts4/concourse/tasks/build-vscode-extensions.sh\n" + "  args: the-args\n" + "  user: admin\n" + "  dir: the-dir\n" + "  bogus: bad\n");
    editor.assertProblems("the-args|Expecting a 'Sequence'", "bogus|Unknown property");
    editor.assertHoverContains("path", "The command to execute, relative to the task's working directory");
    editor.assertHoverContains("args", "Arguments to pass to the command");
    editor.assertHoverContains("dir", "A directory, relative to the initial working directory, to set as the working directory");
    editor.assertHoverContains("user", "Explicitly set the user to run as");
    editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "inputs:\n" + "- name: sts4\n" + "outputs:\n" + "- name: vsix-files\n" + "platform: linux\n" + "image_resource:\n" + "  type: docker-image\n" + "  source:\n" + "    repository: kdvolder/sts4-build-env\n" + "run:\n" + "  user: admin\n");
    editor.assertProblems("run|'path' is required");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 49 with Editor

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

the class ConcourseEditorTest method addSingleRequiredPropertiesQuickfix.

@Test
public void addSingleRequiredPropertiesQuickfix() throws Exception {
    Editor editor = harness.newEditor("resources:\n" + "- name: foo\n" + "  source:\n" + "    username: someone\n" + "# Confuse");
    Diagnostic problem = editor.assertProblems("-|'type' is required", "foo|Unused").get(0);
    CodeAction quickfix = editor.assertCodeAction(problem);
    assertEquals("Add property 'type'", quickfix.getLabel());
    quickfix.perform();
    editor.assertText("resources:\n" + "- name: foo\n" + "  source:\n" + "    username: someone\n" + "  type: <*>\n" + "# Confuse");
}
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 50 with Editor

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

the class ConcourseEditorTest method taskFileMissingToplevelPropertiesUnderlinesLastNonWhitespaceChar.

@Test
public void taskFileMissingToplevelPropertiesUnderlinesLastNonWhitespaceChar() 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, "rootfs_uri: some-image\n" + "   \n");
    editor.assertProblems("rootfs_uri: some-imag^e^|[platform, run] are required");
}
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