Fix failing test

This commit is contained in:
Kris De Volder
2017-07-24 12:25:26 -07:00
parent d75d1438d2
commit 427dbe8b62
4 changed files with 17 additions and 2 deletions

View File

@@ -34,6 +34,9 @@ public class BoshCommandStemcellsProvider extends BoshCommandBasedModelProvider<
private static final YamlTraversal STEMCELL_OSS = STEMCELLS
.thenValAt("os");
private static final YamlTraversal STEMCELL_VERSIONS = STEMCELLS
.thenValAt("version");
@Override
public StemcellsModel getModel(DynamicSchemaContext dc) throws Exception {
JSONCursor cursor = new JSONCursor(getJsonTree());
@@ -80,6 +83,11 @@ public class BoshCommandStemcellsProvider extends BoshCommandBasedModelProvider<
public Collection<String> getStemcellOss() {
return getNames(STEMCELL_OSS);
}
@Override
public Collection<String> getVersions() {
return getNames(STEMCELL_VERSIONS);
}
};
}

View File

@@ -19,4 +19,5 @@ public interface StemcellsModel {
Collection<String> getStemcellNames();
Collection<String> getStemcellOss();
Collection<StemcellData> getStemcells();
Collection<String> getVersions();
}

View File

@@ -936,13 +936,13 @@ public class BoshEditorTest {
editor = harness.newEditor(
"stemcells:\n" +
"- alias: good\n" +
" os: ubuntu-trusty\n" +
" os: ubuntu\n" +
"- alias: not-so-good\n" +
" os: bogus<*>"
);
editor.ignoreProblem(YamlSchemaProblems.MISSING_PROPERTY);
editor.assertProblems(
"bogus|unknown 'StemcellOs'. Valid values are: [centos-7, ubuntu-trusty]"
"bogus|unknown 'StemcellOs'. Valid values are: [ubuntu, centos]"
);
}

View File

@@ -57,4 +57,10 @@ public class BoshCommandStemcellsProviderTest {
provider.getModel(mock(DynamicSchemaContext.class)).getStemcellOss());
}
@Test public void getVersions() throws Exception {
assertEquals(ImmutableSet.of("3421.11"),
provider.getModel(mock(DynamicSchemaContext.class)).getVersions());
}
}