Search in sources :

Example 1 with StemcellsModel

use of org.springframework.ide.vscode.bosh.models.StemcellsModel 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)

Example 2 with StemcellsModel

use of org.springframework.ide.vscode.bosh.models.StemcellsModel in project sts4 by spring-projects.

the class BoshEditorTest method dynamicStemcellNamesFromDirector.

@Test
public void dynamicStemcellNamesFromDirector() throws Exception {
    StemcellsModel stemcellsModel = mock(StemcellsModel.class);
    when(stemcellsProvider.getModel(any())).thenReturn(stemcellsModel);
    when(stemcellsModel.getStemcellNames()).thenReturn(ImmutableMultiset.of("bosh-vsphere-esxi-centos-7-go_agent", "bosh-vsphere-esxi-ubuntu-trusty-go_agent"));
    // content assist
    Editor editor = harness.newEditor("stemcells:\n" + "- alias: blah\n" + "  name: <*>");
    editor.assertContextualCompletions("<*>", "bosh-vsphere-esxi-centos-7-go_agent<*>", "bosh-vsphere-esxi-ubuntu-trusty-go_agent<*>");
    // reconcile
    editor = harness.newEditor("stemcells:\n" + "- alias: good\n" + "  name: bosh-vsphere-esxi-centos-7-go_agent\n" + "- alias: not-so-good\n" + "  name: bogus<*>");
    editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
    editor.assertProblems("bogus|unknown 'StemcellName'. Valid values are: [bosh-vsphere-esxi-centos-7-go_agent, bosh-vsphere-esxi-ubuntu-trusty-go_agent]");
}
Also used : StemcellsModel(org.springframework.ide.vscode.bosh.models.StemcellsModel) Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 StemcellsModel (org.springframework.ide.vscode.bosh.models.StemcellsModel)2 Editor (org.springframework.ide.vscode.languageserver.testharness.Editor)2