use of com.sequenceiq.sdx.api.model.AdvertisedRuntime in project cloudbreak by hortonworks.
the class CDPConfigServiceTest method rt.
private AdvertisedRuntime rt(String version, boolean defaultVersion) {
AdvertisedRuntime advertisedRuntime = new AdvertisedRuntime();
advertisedRuntime.setRuntimeVersion(version);
advertisedRuntime.setDefaultRuntimeVersion(defaultVersion);
return advertisedRuntime;
}
use of com.sequenceiq.sdx.api.model.AdvertisedRuntime in project cloudbreak by hortonworks.
the class CDPConfigService method getAdvertisedRuntimes.
public List<AdvertisedRuntime> getAdvertisedRuntimes(String cloudPlatform) {
List<String> runtimeVersions = getDatalakeVersions(cloudPlatform).stream().filter(runtimeVersion -> advertisedRuntimes.isEmpty() || advertisedRuntimes.contains(runtimeVersion)).collect(Collectors.toList());
Optional<String> calculatedDefault = Strings.isNullOrEmpty(this.defaultRuntime) ? runtimeVersions.stream().findFirst() : Optional.ofNullable(this.defaultRuntime);
List<AdvertisedRuntime> advertisedRuntimes = new ArrayList<>();
for (String runtimeVersion : runtimeVersions) {
AdvertisedRuntime advertisedRuntime = new AdvertisedRuntime();
advertisedRuntime.setRuntimeVersion(runtimeVersion);
if (calculatedDefault.map(r -> r.equals(runtimeVersion)).orElse(false)) {
advertisedRuntime.setDefaultRuntimeVersion(true);
}
advertisedRuntimes.add(advertisedRuntime);
}
LOGGER.debug("Advertised runtime versions for datalake: {}", advertisedRuntimes);
return advertisedRuntimes;
}
Aggregations