use of games.strategy.util.Version in project triplea by triplea-game.
the class DownloadFileDescriptionTest method testIsSkin.
@Test
public void testIsSkin() {
final DownloadFileDescription testObj = new DownloadFileDescription("", "", "", new Version(0, 0), DownloadFileDescription.DownloadType.MAP_SKIN, DownloadFileDescription.MapCategory.EXPERIMENTAL);
assertThat(testObj.isMapSkin(), is(true));
}
use of games.strategy.util.Version in project triplea by triplea-game.
the class DownloadFileDescriptionTest method testGetMapType.
@Test
public void testGetMapType() {
final DownloadFileDescription testObj = new DownloadFileDescription("", "", "", new Version(0, 0), DownloadFileDescription.DownloadType.MAP, DownloadFileDescription.MapCategory.BEST);
assertThat(testObj.getMapCategory(), is(DownloadFileDescription.MapCategory.BEST));
}
use of games.strategy.util.Version in project triplea by triplea-game.
the class DownloadFileDescriptionTest method testIsMap.
@Test
public void testIsMap() {
final DownloadFileDescription testObj = new DownloadFileDescription("", "", "", new Version(0, 0), DownloadFileDescription.DownloadType.MAP, DownloadFileDescription.MapCategory.EXPERIMENTAL);
assertThat(testObj.isMap(), is(true));
}
use of games.strategy.util.Version in project triplea by triplea-game.
the class LobbyPropertyFileParserTest method checkVersionSelection.
/**
* YAML config has multple lobby configs depending on client version. Here we make sure the version checks
* line up and we get the expected lobby config back.
*/
@Test
public void checkVersionSelection() throws Exception {
final File testFile = createTempFile(testDataSet());
final LobbyServerProperties result = LobbyPropertyFileParser.parse(testFile, new Version(TestData.clientCurrentVersion));
assertThat(result.host, is(TestData.hostOther));
assertThat(result.port, is(Integer.valueOf(TestData.portOther)));
assertThat(result.serverMessage, is(""));
assertThat(result.serverErrorMessage, is(""));
}
use of games.strategy.util.Version in project triplea by triplea-game.
the class DownloadFileParser method parse.
public static List<DownloadFileDescription> parse(final InputStream is) {
final JSONArray yamlData = new JSONArray(new Yaml().loadAs(is, List.class));
final List<DownloadFileDescription> downloads = new ArrayList<>();
OpenJsonUtils.stream(yamlData).map(JSONObject.class::cast).forEach(yaml -> {
final String url = yaml.getString(Tags.url.toString());
final String description = yaml.getString(Tags.description.toString());
final String mapName = yaml.getString(Tags.mapName.toString());
final Version version = new Version(yaml.getInt(Tags.version.toString()), 0);
final DownloadFileDescription.DownloadType downloadType = OpenJsonUtils.optEnum(yaml, DownloadFileDescription.DownloadType.class, Tags.mapType.toString(), DownloadFileDescription.DownloadType.MAP);
final DownloadFileDescription.MapCategory mapCategory = OpenJsonUtils.optEnum(yaml, DownloadFileDescription.MapCategory.class, Tags.mapCategory.toString(), DownloadFileDescription.MapCategory.EXPERIMENTAL);
final String img = yaml.optString(Tags.img.toString());
final DownloadFileDescription dl = new DownloadFileDescription(url, description, mapName, version, downloadType, mapCategory, img);
downloads.add(dl);
});
return downloads;
}
Aggregations