Search in sources :

Example 76 with Editor

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

the class ConcourseEditorTest method gitResourceSourceHovers.

@Test
public void gitResourceSourceHovers() throws Exception {
    Editor editor = harness.newEditor("resources:\n" + "- name: sts4-out\n" + "  type: git\n" + "  source:\n" + "    uri: git@github.com:spring-projects/sts4.git\n" + "    bogus: bad\n" + "    branch: {{branch}}\n" + "    private_key: {{rsa_id}}\n" + "    username: jeffy\n" + "    password: {{git_passwords}}\n" + "    paths: not-a-list\n" + "    ignore_paths: also-not-a-list\n" + "    skip_ssl_verification: skip-it\n" + "    tag_filter: RELEASE_*\n" + "    git_config:\n" + "    - name: good\n" + "      val: bad\n" + "    disable_ci_skip: no_ci_skip\n" + "    commit_verification_keys: not-a-list-of-keys\n" + "    commit_verification_key_ids: not-a-list-of-ids\n" + "    gpg_keyserver: hkp://somekeyserver.net");
    editor.assertHoverContains("uri", "*Required.* The location of the repository.");
    editor.assertHoverContains("branch", "The branch to track");
    editor.assertHoverContains("private_key", "Private key to use when pulling/pushing");
    editor.assertHoverContains("username", "Username for HTTP(S) auth");
    editor.assertHoverContains("password", "Password for HTTP(S) auth");
    editor.assertHoverContains("paths", "a list of glob patterns");
    editor.assertHoverContains("ignore_paths", "The inverse of `paths`");
    editor.assertHoverContains("skip_ssl_verification", "Skips git ssl verification");
    editor.assertHoverContains("tag_filter", "the resource will only detect commits");
    editor.assertHoverContains("git_config", "configure git global options");
    editor.assertHoverContains("disable_ci_skip", "Allows for commits that have been labeled with `[ci skip]`");
    editor.assertHoverContains("commit_verification_keys", "Array of GPG public keys");
    editor.assertHoverContains("commit_verification_key_ids", "Array of GPG public key ids");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 77 with Editor

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

the class ConcourseEditorTest method requiredPropertiesReconcile.

@Test
public void requiredPropertiesReconcile() throws Exception {
    Editor editor;
    // addProp(resource, "name", resourceNameDef).isRequired(true);
    editor = harness.newEditor("resources:\n" + "- type: git");
    editor.assertProblems("-^ type: git|'name' is required");
    // addProp(resource, "type", t_resource_type_name).isRequired(true);
    editor = harness.newEditor("resources:\n" + "- name: foo");
    editor.assertProblems("-^ name: foo|'type' is required", "foo|Unused");
    // Both name and type missing:
    editor = harness.newEditor("resources:\n" + "- source: {}");
    editor.assertProblems("-^ source:|[name, type] are required");
    // addProp(job, "name", jobNameDef).isRequired(true);
    editor = harness.newEditor("jobs:\n" + "- name: foo");
    editor.assertProblems("-^ name: foo|'plan' is required");
    // addProp(job, "plan", f.yseq(step)).isRequired(true);
    editor = harness.newEditor("jobs:\n" + "- plan: []");
    editor.assertProblems("-^ plan: []|'name' is required");
    // addProp(resourceType, "name", t_ne_string).isRequired(true);
    editor = harness.newEditor("resource_types:\n" + "- type: docker-image");
    editor.assertProblems("-^ type: docker-image|'name' is required");
    // addProp(resourceType, "type", t_image_type).isRequired(true);
    editor = harness.newEditor("resource_types:\n" + "- name: foo");
    editor.assertProblems("-^ name: foo|'type' is required");
    // addProp(gitSource, "uri", t_string).isRequired(true);
    editor = harness.newEditor("resources:\n" + "- name: foo\n" + "  type: git\n" + "  source:\n" + "    branch: master");
    editor.assertProblems("foo|Unused", "source|'uri' is required");
    // addProp(group, "name", t_ne_string).isRequired(true);
    editor = harness.newEditor("groups:\n" + "- jobs: []");
    editor.assertProblems("-^ jobs: []|'name' is required");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 78 with Editor

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

the class ConcourseEditorTest method poolResourcePutParamsReconcileAndHovers.

@Test
public void poolResourcePutParamsReconcileAndHovers() throws Exception {
    Editor editor;
    editor = harness.newEditor("resources:\n" + "- name: my-locks\n" + "  type: pool\n" + "jobs:\n" + "- name: a-job\n" + "  plan:\n" + "  - put: my-locks\n" + "    params:\n" + "      acquire: should-acquire\n" + "      claim: a-specific-lock\n" + "      release: path/to/lock\n" + "      add: path/to/lock\n" + "      add_claimed: path/to/lock\n" + "      remove: path/to/lock");
    editor.assertProblems("acquire|Only one of", "should-acquire|'boolean'", "claim|Only one of", "release|Only one of", "add|Only one of", "add_claimed|Only one of", "remove|Only one of");
    editor.assertHoverContains("acquire", "attempt to move a randomly chosen lock");
    editor.assertHoverContains("claim", "the specified lock from the pool will be acquired");
    editor.assertHoverContains("release", "release the lock");
    editor.assertHoverContains("add", "add a new lock to the pool in the unclaimed state");
    editor.assertHoverContains("add_claimed", "in the *claimed* state");
    editor.assertHoverContains("remove", "remove the given lock from the pool");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 79 with Editor

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

the class ConcourseEditorTest method assertContextualCompletions.

private void assertContextualCompletions(LanguageId language, Predicate<CompletionItem> isInteresting, String conText, String textBefore, String... textAfter) throws Exception {
    Editor editor = harness.newEditor(language, conText);
    // this ensures the conText is parsed and its AST is cached (will be used for
    editor.reconcile();
    // dynamic CA when the conText + textBefore is not parsable.
    assertContains(CURSOR, conText);
    textBefore = conText.replace(CURSOR, textBefore);
    textAfter = Arrays.stream(textAfter).map((String t) -> conText.replace(CURSOR, t)).collect(Collectors.toList()).toArray(new String[0]);
    editor.setText(textBefore);
    editor.assertCompletions(isInteresting, textAfter);
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor)

Example 80 with Editor

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

the class ConcourseEditorTest method reconcileExplicitResourceAttributeInPutStep.

@Test
public void reconcileExplicitResourceAttributeInPutStep() throws Exception {
    // See: https://www.pivotaltracker.com/story/show/138568839
    Editor editor;
    editor = harness.newEditor("resources:\n" + "- name: aws-environments\n" + "  type: pool\n" + "jobs:\n" + "- name: test-multi-aws\n" + "  plan:\n" + "    - put: environment-1\n" + "      resource: aws-environments\n" + "      params:\n" + "        acquire: true\n" + "        bogus_param: bad\n" + "      get_params:\n" + "        bogus_get_param: bad");
    editor.assertProblems("bogus_param|Unknown property", "bogus_get_param|Unknown property");
    editor = harness.newEditor("resources:\n" + "- name: aws-environments\n" + "  type: pool\n" + "jobs:\n" + "- name: test-multi-aws\n" + "  plan:\n" + "    - get: environment-1\n" + "      resource: aws-environments\n" + "      params:\n" + "        bogus_param: bad\n");
    editor.assertProblems("bogus_param|Unknown property");
    editor = harness.newEditor("resources:\n" + "- name: aws-environments\n" + "  type: pool\n" + "  source:\n" + "    uri: git@github.com:concourse/locks.git\n" + "    branch: master\n" + "    pool: aws\n" + "    private_key: |\n" + "      -----BEGIN RSA PRIVATE KEY-----\n" + "      MIIEowIBAAKCAQEAtCS10/f7W7lkQaSgD/mVeaSOvSF9ql4hf/zfMwfVGgHWjj+W\n" + "      ...\n" + "      DWiJL+OFeg9kawcUL6hQ8JeXPhlImG6RTUffma9+iGQyyBMCGd1l\n" + "      -----END RSA PRIVATE KEY-----\n" + "    username: jonhsmith\n" + "    password: his-password\n" + "    retry_delay: 10s\n" + "jobs:\n" + "- name: test-multi-aws\n" + "  plan:\n" + "    - get: aws-environments\n" + "      params: {}     \n" + "    - put: environment-1\n" + "      resource: aws-environments\n" + "      params: {acquire: true}\n" + "    - put: environment-2\n" + "      resource: aws-environments\n" + "      params: \n" + "        acquire: true\n" + "        bogus_param: blah\n" + "    - task: test-multi-aws\n" + "      file: my-scripts/test-multi-aws.yml\n" + "    - put: aws-environments\n" + "      params: {release: environment-1}\n" + "    - put: aws-environments\n" + "      params: {release: environment-2}");
    editor.assertProblems("bogus_param|Unknown property");
}
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