use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class BoshEditorTest method reconcileStemcellReference.
@Test
public void reconcileStemcellReference() throws Exception {
Editor editor = harness.newEditor("name: foo\n" + "instance_groups: \n" + "- name: some-server\n" + " stemcell: default\n" + "- name: windoze-server\n" + " stemcell: windoze\n" + "- name: bad-server\n" + " stemcell: bogus-stemcell\n" + "stemcells:\n" + "- alias: default\n" + " os: ubuntu\n" + " version: 1346.77.1\n" + "- alias: windoze\n" + " os: windows\n" + " version: 678.9.1\n");
editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
editor.assertProblems("bogus-stemcell|unknown 'StemcellAlias'. Valid values are: [default, windoze]");
}
use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class BoshEditorTest method contentAssistShowsWarningWhenCloudConfigThrows.
@Test
public void contentAssistShowsWarningWhenCloudConfigThrows() throws Exception {
cloudConfigProvider.executeCommandWith(() -> {
throw new TimeoutException("Reading cloud config timed out");
});
Editor editor = harness.newEditor("name: foo\n" + "instance_groups: \n" + "- name: some-server\n" + " vm_type: <*>");
CompletionItem completion = editor.assertCompletionLabels("TimeoutException").get(0);
completion = harness.resolveCompletionItem(completion);
assertContains("Reading cloud config timed out", completion.getDocumentation());
}
use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class BoshEditorTest method cloudconfig_manual_network_hovers.
@Test
public void cloudconfig_manual_network_hovers() throws Exception {
Editor editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "networks:\n" + "- name: my-network\n" + " type: manual\n" + "\n" + " subnets:\n" + " - range: 10.10.0.0/24\n" + " gateway: 10.10.0.1\n" + " dns: [10.10.0.2]\n" + "\n" + " # IPs that will not be used for anything\n" + " reserved: [10.10.0.2-10.10.0.10]\n" + " az: z1\n" + "\n" + " cloud_properties: {subnet: subnet-9be6c3f7}\n" + "\n" + " - range: 10.10.1.0/24\n" + " gateway: 10.10.1.1\n" + " dns: [10.10.1.2]\n" + "\n" + " static: [10.10.1.11-10.10.1.20]\n" + "\n" + " azs: [z2, z3]\n" + " cloud_properties: {subnet: subnet-9be6c6gh}");
editor.assertHoverContains("name", "Name used to reference this network configuration");
editor.assertHoverContains("type", "The type of configuration. Should be one of `manual`, `dynamic` or `vip`");
editor.assertHoverContains("subnets", "Lists subnets in this network");
editor.assertHoverContains("range", "Subnet IP range that includes all IPs from this subnet");
editor.assertHoverContains("gateway", "Subnet gateway IP");
editor.assertHoverContains("dns", "DNS IP addresses for this subnet");
editor.assertHoverContains("reserved", "Array of reserved IPs and/or IP ranges. BOSH does not assign IPs from this range to any VM");
editor.assertHoverContains("static", "Array of static IPs and/or IP ranges.");
editor.assertHoverContains("az", "AZ associated with this subnet");
editor.assertHoverContains("azs", "List of AZs associated with this subnet");
editor.assertHoverContains("cloud_properties", "Describes any IaaS-specific properties for the subnet");
}
use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class BoshEditorTest method reconcileAZs.
@Test
public void reconcileAZs() throws Exception {
Editor editor = harness.newEditor("name: my-first-deployment\n" + "instance_groups:\n" + "- name: my-server\n" + " azs: [z1, z2, z-bogus]\n");
editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
editor.assertProblems("z-bogus|unknown 'AvailabilityZone'. Valid values are: [z1, z2, z3]");
}
use of org.springframework.ide.vscode.languageserver.testharness.Editor in project sts4 by spring-projects.
the class BoshEditorTest method contentAssistStemcellNameNoDirector.
@Test
public void contentAssistStemcellNameNoDirector() 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: <*>\n");
List<CompletionItem> completions = editor.getCompletions();
assertEquals(1, completions.size());
CompletionItem c = completions.get(0);
c = harness.resolveCompletionItem(c);
assertContains("Couldn't connect to bosh", c.getDocumentation());
System.out.println("label = " + c.getLabel());
System.out.println("detail = " + c.getDetail());
System.out.println("doc = " + c.getDocumentation());
}
Aggregations