Search in sources :

Example 81 with Editor

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

the class ConcourseEditorTest method emptyInputPathWarning.

@Test
public void emptyInputPathWarning() throws Exception {
    Editor editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "platform: linux\n" + "run:\n" + "  path: blah\n" + "inputs:\n" + "- name: foo\n" + "  path: \"\"\n" + "outputs:\n" + "- name: bar\n" + "  path: \"\"\n");
    List<Diagnostic> problems = editor.assertProblems("\"\"|Empty optional String attribute is useless and can be omitted", "\"\"|Empty optional String attribute is useless and can be omitted");
    for (Diagnostic problem : problems) {
        assertEquals(DiagnosticSeverity.Warning, problem.getSeverity());
    }
}
Also used : Diagnostic(org.eclipse.lsp4j.Diagnostic) Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 82 with Editor

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

the class ConcourseEditorTest method s3ResourceGetParamsReconcileAndHovers.

@Test
public void s3ResourceGetParamsReconcileAndHovers() 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" + "  - get: my-s3-bucket\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 83 with Editor

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

the class ConcourseEditorTest method cfResourceSourceHovers.

@Test
public void cfResourceSourceHovers() throws Exception {
    Editor editor = harness.newEditor("resources:\n" + "- name: pws\n" + "  type: cf\n" + "  source:\n" + "    api: {{cf_api}}\n" + "    username: {{cf_user}}\n" + "    password: {{cf_password}}\n" + "    organization: {{cf_org}}\n" + "    space: {{cf_space}}\n" + "    skip_cert_check: true<*>");
    editor.assertHoverContains("api", "address of the Cloud Controller");
    editor.assertHoverContains("username", "username used to authenticate");
    editor.assertHoverContains("password", "password used to authenticate");
    editor.assertHoverContains("organization", "organization to push");
    editor.assertHoverContains("space", "space to push");
    editor.assertHoverContains("skip_cert_check", "Check the validity of the CF SSL cert");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 84 with Editor

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

the class ConcourseEditorTest method githubUriReconciling.

@Test
public void githubUriReconciling() throws Exception {
    when(github.getReposForOwner("the-owner")).thenReturn(ImmutableList.of("nice-repo", "cool-project", "good-stuff"));
    when(github.getReposForOwner("owner-no-exist")).thenReturn(null);
    String editorText = "resources:\n" + "- name: my-repo\n" + "  type: git\n" + "  source:\n" + "    uri: $$github$$the-owner/cool-project.git\n" + "- name: other-repo\n" + "  type: git\n" + "  source:\n" + "    uri: $$github$$the-owner/repo-no-exist.git\n" + "- name: different-repo\n" + "  type: git\n" + "  source:\n" + "    uri: $$github$$owner-no-exist/who-cares.git\n";
    for (String githubUriPrefix : GithubRepoContentAssistant.URI_PREFIXES) {
        Editor editor = harness.newEditor(editorText.replace("$$github$$", githubUriPrefix));
        editor.ignoreProblem(PipelineYmlSchemaProblems.UNUSED_RESOURCE);
        List<Diagnostic> problems = editor.assertProblems("repo-no-exist|Repo not found: 'repo-no-exist'", "owner-no-exist|User or Organization not found: 'owner-no-exist'");
        for (Diagnostic d : problems) {
            assertEquals(DiagnosticSeverity.Warning, d.getSeverity());
        }
    }
}
Also used : Diagnostic(org.eclipse.lsp4j.Diagnostic) Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 85 with Editor

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

the class ConcourseEditorTest method gitResourceGetParamsReconcile.

@Test
public void gitResourceGetParamsReconcile() throws Exception {
    Editor editor = harness.newEditor("resources:\n" + "- name: my-git\n" + "  type: git\n" + "jobs:\n" + "- name: do-stuff\n" + "  plan:\n" + "  - get: my-git\n" + "    params:\n" + "      depth: -1\n" + "      disable_git_lfs: not-bool\n");
    editor.assertProblems("-1|must be positive", "not-bool|'boolean'");
}
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