Search in sources :

Example 26 with Editor

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

the class BoshEditorTest method documentSymbols.

@Test
public void documentSymbols() throws Exception {
    Editor editor = harness.newEditor("name: foo\n" + "variables:\n" + "- name: blobstore_admin_users_password\n" + "  type: password\n" + "- name: blobstore_secure_link_secret\n" + "  type: password\n" + "stemcells:\n" + "- alias: default\n" + "  os: ubuntu-trusty\n" + "  version: '3421.11'\n" + "instance_groups:\n" + "- name: foo-group\n" + "  networks:\n" + "  - name: the-network\n" + "    static_ips: []\n" + "    default: []\n" + "- name: bar-group\n" + "  networks:\n" + "  - name: the-network\n" + "    static_ips: []\n" + "    default: []\n" + "releases:\n" + "- name: one-release\n" + "- name: other-release\n");
    editor.assertDocumentSymbols("default|StemcellAlias", "foo-group|InstanceGroup", "bar-group|InstanceGroup", "one-release|Release", "other-release|Release", "blobstore_admin_users_password|Variable", "blobstore_secure_link_secret|Variable");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 27 with Editor

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

the class BoshEditorTest method instanceGroupsHovers.

@Test
public void instanceGroupsHovers() throws Exception {
    Editor editor = harness.newEditor("instance_groups:\n" + "- name: redis-master\n" + "  properties: {}\n" + "  instances: 1\n" + "  azs: [z1, z2]\n" + "  jobs:\n" + "  - name: redis-server\n" + "    release: redis\n" + "    properties:\n" + "      port: 3606\n" + "  vm_type: medium\n" + "  vm_extensions: [public-lbs]\n" + "  stemcell: default\n" + "  persistent_disk_type: medium\n" + "  networks:\n" + "  - name: default\n" + "\n" + "- name: redis-slave\n" + "  instances: 2\n" + "  azs: [z1, z2]\n" + "  jobs:\n" + "  - name: redis-server\n" + "    release: redis\n" + "    properties: {}\n" + "  update:\n" + "    canaries: 2\n" + "  lifecycle: errand\n" + "  migrated_from: []\n" + "  env: {}\n" + "  vm_type: medium\n" + "  stemcell: default\n" + "  persistent_disk_type: medium\n" + "  networks:\n" + "  - name: default\n");
    editor.assertHoverContains("name", "A unique name used to identify and reference the instance group.");
    editor.assertHoverContains("azs", "List of AZs associated with this instance group");
    editor.assertHoverContains("instances", "The number of instances in this group");
    editor.assertHoverContains("jobs", "Specifies the name and release of jobs that will be installed on each instance.");
    editor.assertHoverContains("vm_type", "A valid VM type name from the cloud config");
    editor.assertHoverContains("vm_extensions", "A valid list of VM extension names from the cloud config");
    editor.assertHoverContains("stemcell", "A valid stemcell alias from the Stemcells Block");
    editor.assertHoverContains("persistent_disk_type", "A valid disk type name from the cloud config.");
    editor.assertHoverContains("networks", "Specifies the networks this instance requires");
    editor.assertHoverContains("update", "Specific update settings for this instance group");
    editor.assertHoverContains("migrated_from", "Specific migration settings for this instance group.");
    editor.assertHoverContains("lifecycle", "Specifies the kind of workload");
    editor.assertHoverContains("properties", "Specifies instance group properties");
    editor.assertHoverContains("env", "Specifies advanced BOSH Agent configuration");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 28 with Editor

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

the class BoshEditorTest method cloudconfig_at_least_one_required.

@Test
public void cloudconfig_at_least_one_required() throws Exception {
    Editor editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "azs: []\n" + "vm_types: []\n" + "networks: []\n" + "disk_types: []\n" + // This one should be okay!
    "vm_extensions: []");
    editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
    editor.assertProblems("[]|At least one 'AZ' is required", "[]|At least one 'VMType' is required", "[]|At least one 'Network' is required", "[]|At least one 'DiskType' is required");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 29 with Editor

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

the class BoshEditorTest method reconcileVMExtensions2.

@Test
public void reconcileVMExtensions2() throws Exception {
    cloudConfigProvider.readWith(() -> "vm_extensions:\n" + "- name: pub-lbs\n" + "  cloud_properties:\n" + "    elbs: [main]");
    Editor editor = harness.newEditor("name: my-first-deployment\n" + "instance_groups:\n" + "- name: my-server\n" + "  vm_extensions:\n" + "  - pub-lbs\n" + "  - bogus");
    editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
    editor.assertProblems("bogus|unknown 'VMExtension'. Valid values are: [pub-lbs]");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 30 with Editor

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

the class BoshEditorTest method stemcellHovers.

@Test
public void stemcellHovers() throws Exception {
    Editor editor = harness.newEditor("stemcells:\n" + "- alias: default\n" + "  os: ubuntu-trusty\n" + "  version: 3147\n" + "  name: bosh-aws-xen-hvm-ubuntu-trusty-go_agent");
    editor.assertHoverContains("alias", "Name of a stemcell used in the deployment");
    editor.assertHoverContains("os", "Operating system of a matching stemcell");
    editor.assertHoverContains("version", "The version of a matching stemcell");
    editor.assertHoverContains("name", "Full name of a matching stemcell. Either `name` or `os` keys can be specified.");
}
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