Search in sources :

Example 16 with Editor

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

the class BoshEditorTest method reconcileStemcellVersionNoDirector.

@SuppressWarnings("unchecked")
@Test
public void reconcileStemcellVersionNoDirector() 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: aaa\n" + "  name: centos-agent\n" + "  version: 222.2\n" + "- alias: bbb\n" + "  name: centos-agent\n" + "  version: 123.4\n" + "- alias: ddd\n" + "  os: ubuntu\n" + "  version: 333.3\n" + "- alias: eee\n" + "  os: ubuntu\n" + "  version: latest\n");
    editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
    editor.assertProblems();
}
Also used : DynamicModelProvider(org.springframework.ide.vscode.bosh.models.DynamicModelProvider) IOException(java.io.IOException) Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 17 with Editor

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

the class BoshEditorTest method reconcileReleaseNameDef.

@Test
public void reconcileReleaseNameDef() throws Exception {
    releasesProvider = provideReleasesFrom(new ReleaseData("foo", "123.4"), new ReleaseData("foo", "222.2"), new ReleaseData("bar", "222.2"), new ReleaseData("bar", "333.3"));
    Editor editor = harness.newEditor("releases:\n" + "- name: foo\n" + "- name: bar\n" + "- name: bogus\n" + "- name: url-makes-this-ok\n" + "  url: file://blah");
    editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
    editor.assertProblems("bogus|unknown 'ReleaseName'. Valid values are: [foo, bar]");
}
Also used : ReleaseData(org.springframework.ide.vscode.bosh.models.ReleaseData) Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 18 with Editor

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

the class BoshEditorTest method cloudconfig_azs.

@Test
public void cloudconfig_azs() throws Exception {
    Editor editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "azs:\n" + "- <*>");
    editor.assertContextualCompletions("<*>", "name: <*>");
    editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "azs:\n" + "- name: the-zone\n" + "  <*>");
    editor.assertContextualCompletions(PLAIN_COMPLETION, "<*>", "cloud_properties:\n" + "    <*>");
    editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "azs:\n" + "- name: the-zone\n" + "  cloud_properties: {}\n");
    editor.assertHoverContains("name", "Name of an AZ within the Director");
    editor.assertHoverContains("cloud_properties", "Describes any IaaS-specific properties needed to associated with AZ");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 19 with Editor

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

the class BoshEditorTest method cloudconfig_dynamic_network_hovers.

@Test
public void cloudconfig_dynamic_network_hovers() throws Exception {
    Editor editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "networks:\n" + "- name: foo\n" + "  type: dynamic\n" + "  dns: []\n" + "  cloud_properties: {}\n");
    editor.assertHoverContains("name", "Name used to reference this network configuration");
    editor.assertHoverContains("type", "The type of configuration");
    editor.assertHoverContains("dns", "DNS IP addresses for this network");
    editor.assertHoverContains("cloud_properties", "Describes any IaaS-specific properties for the network");
    editor = harness.newEditor(LanguageId.BOSH_CLOUD_CONFIG, "networks:\n" + "- name: my-network\n" + "  type: dynamic\n" + "  subnets:\n" + "  - az: z1\n" + "    dns: []\n" + "    cloud_properties: {subnet: subnet-9be6c3f7}\n" + "  - azs: [z2, z3]\n" + "    cloud_properties: {subnet: subnet-9be6c384}");
    editor.assertHoverContains("name", "Name used to reference this network configuration");
    editor.assertHoverContains("type", "The type of configuration");
    editor.assertHoverContains("subnets", "Lists subnets in this network");
    editor.assertHoverContains("dns", "DNS IP addresses for this subnet");
    editor.assertHoverContains("az", "AZ associated with this subnet");
    editor.assertHoverContains("cloud_properties", "Describes any IaaS-specific properties for the subnet");
    editor.assertHoverContains("azs", "List of AZs associated with this subnet");
}
Also used : Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 20 with Editor

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

the class BoshEditorTest method dynamicStemcellOssFromDirector.

@Test
public void dynamicStemcellOssFromDirector() throws Exception {
    StemcellsModel stemcellsModel = mock(StemcellsModel.class);
    when(stemcellsProvider.getModel(any())).thenReturn(stemcellsModel);
    when(stemcellsModel.getStemcellOss()).thenReturn(ImmutableSet.of("ubuntu", "centos"));
    // content assist
    Editor editor = harness.newEditor("stemcells:\n" + "- os: <*>");
    editor.assertContextualCompletions("<*>", "centos<*>", "ubuntu<*>");
    // reconcile
    editor = harness.newEditor("stemcells:\n" + "- alias: good\n" + "  os: ubuntu\n" + "- alias: not-so-good\n" + "  os: bogus<*>");
    editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
    editor.assertProblems("bogus|unknown 'StemcellOs'. Valid values are: [ubuntu, centos]");
}
Also used : StemcellsModel(org.springframework.ide.vscode.bosh.models.StemcellsModel) 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