@Test void getCdhPatchVersionMissingCdhProduct() { TemplatePreparationObject source = new TemplatePreparationObject.Builder() .withProductDetails(cmRepo(), products("SCHEMAREGISTRY=0.8.0.3.0.0.0-97")) .build(); assertThat(KafkaConfigProviderUtils.getCdhPatchVersion(source)).isEmpty(); }
@VisibleForTesting static Optional<Integer> getCdhPatchVersion(TemplatePreparationObject source) { if (null != source.getProductDetailsView() && null != source.getProductDetailsView().getProducts()) { Optional<ClouderaManagerProduct> cdh = source.getProductDetailsView().getProducts() .stream() .filter(p -> "CDH".equals(p.getName())) .findAny(); return cdh.flatMap(p -> getPatchFromVersionString(p.getVersion())); } else { return Optional.empty(); } }
KafkaConfigProviderUtils { @VisibleForTesting static Optional<Integer> getCdhPatchVersion(TemplatePreparationObject source) { if (null != source.getProductDetailsView() && null != source.getProductDetailsView().getProducts()) { Optional<ClouderaManagerProduct> cdh = source.getProductDetailsView().getProducts() .stream() .filter(p -> "CDH".equals(p.getName())) .findAny(); return cdh.flatMap(p -> getPatchFromVersionString(p.getVersion())); } else { return Optional.empty(); } } }
KafkaConfigProviderUtils { @VisibleForTesting static Optional<Integer> getCdhPatchVersion(TemplatePreparationObject source) { if (null != source.getProductDetailsView() && null != source.getProductDetailsView().getProducts()) { Optional<ClouderaManagerProduct> cdh = source.getProductDetailsView().getProducts() .stream() .filter(p -> "CDH".equals(p.getName())) .findAny(); return cdh.flatMap(p -> getPatchFromVersionString(p.getVersion())); } else { return Optional.empty(); } } private  KafkaConfigProviderUtils(); }
KafkaConfigProviderUtils { @VisibleForTesting static Optional<Integer> getCdhPatchVersion(TemplatePreparationObject source) { if (null != source.getProductDetailsView() && null != source.getProductDetailsView().getProducts()) { Optional<ClouderaManagerProduct> cdh = source.getProductDetailsView().getProducts() .stream() .filter(p -> "CDH".equals(p.getName())) .findAny(); return cdh.flatMap(p -> getPatchFromVersionString(p.getVersion())); } else { return Optional.empty(); } } private  KafkaConfigProviderUtils(); static CdhVersionForStreaming getCdhVersionForStreaming(TemplatePreparationObject source); }
KafkaConfigProviderUtils { @VisibleForTesting static Optional<Integer> getCdhPatchVersion(TemplatePreparationObject source) { if (null != source.getProductDetailsView() && null != source.getProductDetailsView().getProducts()) { Optional<ClouderaManagerProduct> cdh = source.getProductDetailsView().getProducts() .stream() .filter(p -> "CDH".equals(p.getName())) .findAny(); return cdh.flatMap(p -> getPatchFromVersionString(p.getVersion())); } else { return Optional.empty(); } } private  KafkaConfigProviderUtils(); static CdhVersionForStreaming getCdhVersionForStreaming(TemplatePreparationObject source);  }