Search in sources :

Example 21 with Editor

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]");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 22 with Editor

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());
}
Also used : CompletionItem(org.eclipse.lsp4j.CompletionItem) Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) TimeoutException(java.util.concurrent.TimeoutException) Test(org.junit.Test)

Example 23 with Editor

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");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 24 with Editor

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]");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 25 with Editor

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());
}
Also used : CompletionItem(org.eclipse.lsp4j.CompletionItem) DynamicModelProvider(org.springframework.ide.vscode.bosh.models.DynamicModelProvider) IOException(java.io.IOException) 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