use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class BoshEditorTest method cloudconfig_vm_types_subproperties.
@Test
public void cloudconfig_vm_types_subproperties() throws Exception {
Editor editor;
editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "vm_types:\n" + "- <*>");
editor.assertContextualCompletions("<*>", "name: <*>");
editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "vm_types:\n" + "- name: nice-vm\n" + " <*>");
editor.assertContextualCompletions(PLAIN_COMPLETION, "<*>", "cloud_properties:\n <*>");
editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "vm_types:\n" + "- name: nice-vm\n" + "- name: dup\n" + "- name: dup\n");
editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
editor.assertProblems("dup|Duplicate 'VMTypeName'", "dup|Duplicate 'VMTypeName'");
editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "vm_types:\n" + "- name: default\n" + " cloud_properties:\n" + " instance_type: m1.small\n");
editor.assertHoverContains("name", "A unique name used to identify and reference the VM type");
editor.assertHoverContains("cloud_properties", "Describes any IaaS-specific properties needed to create VMs");
}
use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class BoshEditorTest method contentAssistStemcellVersionFromDirector.
@Test
public void contentAssistStemcellVersionFromDirector() throws Exception {
Editor editor;
stemcellsProvider = provideStemcellsFrom(new StemcellData("ubuntu-agent", "123.4", "ubuntu"), new StemcellData("ubuntu-agent", "222.2", "ubuntu"), new StemcellData("centos-agent", "222.2", "centos"), new StemcellData("centos-agent", "333.3", "centos"));
editor = harness.newEditor("stemcells:\n" + "- alias: good\n" + " name: centos-agent\n" + " version: <*>\n");
editor.assertContextualCompletions("<*>", "222.2<*>", "333.3<*>", "latest<*>");
editor = harness.newEditor("stemcells:\n" + "- alias: good\n" + " os: ubuntu\n" + " version: <*>\n");
editor.assertContextualCompletions("<*>", "123.4<*>", "222.2<*>", "latest<*>");
editor = harness.newEditor("stemcells:\n" + "- alias: good\n" + " version: <*>\n");
editor.assertContextualCompletions("<*>", "123.4<*>", "222.2<*>", "333.3<*>", "latest<*>");
// when os and name are 'bogus' at least suggest proposals based on other prop
editor = harness.newEditor("stemcells:\n" + "- alias: good\n" + " name: centos-agent\n" + " os: bogus\n" + " version: <*>\n");
editor.assertContextualCompletions("<*>", "222.2<*>", "333.3<*>", "latest<*>");
editor = harness.newEditor("stemcells:\n" + "- alias: good\n" + " os: centos\n" + " name: bogus\n" + " version: <*>\n");
editor.assertContextualCompletions("<*>", "222.2<*>", "333.3<*>", "latest<*>");
// when the os and name disagree, merge the proposals for both:
editor = harness.newEditor("stemcells:\n" + "- alias: good\n" + // Contradicts the name
" os: centos\n" + // Contradicts the os
" name: ubuntu-agent\n" + " version: <*>\n");
editor.assertContextualCompletions("<*>", "123.4<*>", "222.2<*>", "333.3<*>", "latest<*>");
}
use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class BoshEditorTest method contentAssistStemcellVersionNoDirector.
@SuppressWarnings("unchecked")
@Test
public void contentAssistStemcellVersionNoDirector() throws Exception {
Editor editor;
stemcellsProvider = mock(DynamicModelProvider.class);
when(stemcellsProvider.getModel(any())).thenThrow(new IOException("Couldn't connect to bosh"));
editor = harness.newEditor("stemcells:\n" + "- alias: good\n" + " name: centos-agent\n" + " version: <*>\n");
editor.assertContextualCompletions("<*>", "latest<*>");
}
use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class BoshEditorTest method reconcileVMtype.
@Test
public void reconcileVMtype() throws Exception {
Editor editor = harness.newEditor("name: foo\n" + "instance_groups: \n" + "- name: some-server\n" + " vm_type: bogus-vm\n" + "- name: other-server\n" + " vm_type: large");
editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
editor.assertProblems("bogus-vm|unknown 'VMType'. Valid values are: [default, large]");
assertEquals(1, cloudConfigProvider.getReadCount());
}
use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class BoshEditorTest method reconcilePersistentDiskType2.
@Test
public void reconcilePersistentDiskType2() throws Exception {
cloudConfigProvider.readWith(() -> "disk_types:\n" + "- name: small-disk\n" + "- name: large-disk\n");
Editor editor = harness.newEditor("name: my-first-deployment\n" + "instance_groups:\n" + "- name: my-server1\n" + " persistent_disk_type: small-disk\n" + "- name: my-server2\n" + " persistent_disk_type: bogus\n" + "- name: my-server3\n" + " persistent_disk_type: large-disk\n");
editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
editor.assertProblems("bogus|unknown 'DiskType'. Valid values are: [small-disk, large-disk]");
}
Aggregations