@Test public void testConvertWhenProxyConfigNotNullThenProxyConfigNameShouldBePassed() { String expected = "proxy name value"; when(cluster.getProxyConfigCrn()).thenReturn(expected); ClusterV4Request result = underTest.convert(cluster); assertEquals(expected, result.getProxyConfigCrn()); }
@Override public ClusterV4Request convert(Cluster source) { ClusterV4Request clusterRequest = new ClusterV4Request(); convertClusterManager(source, clusterRequest); clusterRequest.setBlueprintName(source.getBlueprint().getName()); clusterRequest.setValidateBlueprint(null); clusterRequest.setExecutorType(source.getExecutorType()); clusterRequest.setUserName(""); clusterRequest.setPassword(""); if (source.getFileSystem() != null) { clusterRequest.setCloudStorage(cloudStorageConverter.fileSystemToRequest(source.getFileSystem())); } clusterRequest.setName(source.getName()); if (source.getRdsConfigs() != null && !source.getRdsConfigs().isEmpty()) { Set<String> databaseNames = source.getRdsConfigs().stream() .filter(rdsConfig -> rdsConfig.getStatus() == ResourceStatus.USER_MANAGED) .map(RDSConfig::getName) .collect(Collectors.toSet()); clusterRequest.setDatabases(Collections.unmodifiableSet(databaseNames)); } if (StringUtils.isNotEmpty(source.getProxyConfigCrn())) { clusterRequest.setProxyConfigCrn(source.getProxyConfigCrn()); } if (source.getGateway() != null) { clusterRequest.setGateway(getConversionService().convert(source.getGateway(), GatewayV4Request.class)); } clusterRequest.setRangerRazEnabled(source.isRangerRazEnabled()); return clusterRequest; }
ClusterToClusterV4RequestConverter extends AbstractConversionServiceAwareConverter<Cluster, ClusterV4Request> { @Override public ClusterV4Request convert(Cluster source) { ClusterV4Request clusterRequest = new ClusterV4Request(); convertClusterManager(source, clusterRequest); clusterRequest.setBlueprintName(source.getBlueprint().getName()); clusterRequest.setValidateBlueprint(null); clusterRequest.setExecutorType(source.getExecutorType()); clusterRequest.setUserName(""); clusterRequest.setPassword(""); if (source.getFileSystem() != null) { clusterRequest.setCloudStorage(cloudStorageConverter.fileSystemToRequest(source.getFileSystem())); } clusterRequest.setName(source.getName()); if (source.getRdsConfigs() != null && !source.getRdsConfigs().isEmpty()) { Set<String> databaseNames = source.getRdsConfigs().stream() .filter(rdsConfig -> rdsConfig.getStatus() == ResourceStatus.USER_MANAGED) .map(RDSConfig::getName) .collect(Collectors.toSet()); clusterRequest.setDatabases(Collections.unmodifiableSet(databaseNames)); } if (StringUtils.isNotEmpty(source.getProxyConfigCrn())) { clusterRequest.setProxyConfigCrn(source.getProxyConfigCrn()); } if (source.getGateway() != null) { clusterRequest.setGateway(getConversionService().convert(source.getGateway(), GatewayV4Request.class)); } clusterRequest.setRangerRazEnabled(source.isRangerRazEnabled()); return clusterRequest; } }
ClusterToClusterV4RequestConverter extends AbstractConversionServiceAwareConverter<Cluster, ClusterV4Request> { @Override public ClusterV4Request convert(Cluster source) { ClusterV4Request clusterRequest = new ClusterV4Request(); convertClusterManager(source, clusterRequest); clusterRequest.setBlueprintName(source.getBlueprint().getName()); clusterRequest.setValidateBlueprint(null); clusterRequest.setExecutorType(source.getExecutorType()); clusterRequest.setUserName(""); clusterRequest.setPassword(""); if (source.getFileSystem() != null) { clusterRequest.setCloudStorage(cloudStorageConverter.fileSystemToRequest(source.getFileSystem())); } clusterRequest.setName(source.getName()); if (source.getRdsConfigs() != null && !source.getRdsConfigs().isEmpty()) { Set<String> databaseNames = source.getRdsConfigs().stream() .filter(rdsConfig -> rdsConfig.getStatus() == ResourceStatus.USER_MANAGED) .map(RDSConfig::getName) .collect(Collectors.toSet()); clusterRequest.setDatabases(Collections.unmodifiableSet(databaseNames)); } if (StringUtils.isNotEmpty(source.getProxyConfigCrn())) { clusterRequest.setProxyConfigCrn(source.getProxyConfigCrn()); } if (source.getGateway() != null) { clusterRequest.setGateway(getConversionService().convert(source.getGateway(), GatewayV4Request.class)); } clusterRequest.setRangerRazEnabled(source.isRangerRazEnabled()); return clusterRequest; }  }
ClusterToClusterV4RequestConverter extends AbstractConversionServiceAwareConverter<Cluster, ClusterV4Request> { @Override public ClusterV4Request convert(Cluster source) { ClusterV4Request clusterRequest = new ClusterV4Request(); convertClusterManager(source, clusterRequest); clusterRequest.setBlueprintName(source.getBlueprint().getName()); clusterRequest.setValidateBlueprint(null); clusterRequest.setExecutorType(source.getExecutorType()); clusterRequest.setUserName(""); clusterRequest.setPassword(""); if (source.getFileSystem() != null) { clusterRequest.setCloudStorage(cloudStorageConverter.fileSystemToRequest(source.getFileSystem())); } clusterRequest.setName(source.getName()); if (source.getRdsConfigs() != null && !source.getRdsConfigs().isEmpty()) { Set<String> databaseNames = source.getRdsConfigs().stream() .filter(rdsConfig -> rdsConfig.getStatus() == ResourceStatus.USER_MANAGED) .map(RDSConfig::getName) .collect(Collectors.toSet()); clusterRequest.setDatabases(Collections.unmodifiableSet(databaseNames)); } if (StringUtils.isNotEmpty(source.getProxyConfigCrn())) { clusterRequest.setProxyConfigCrn(source.getProxyConfigCrn()); } if (source.getGateway() != null) { clusterRequest.setGateway(getConversionService().convert(source.getGateway(), GatewayV4Request.class)); } clusterRequest.setRangerRazEnabled(source.isRangerRazEnabled()); return clusterRequest; }  @Override ClusterV4Request convert(Cluster source); }
ClusterToClusterV4RequestConverter extends AbstractConversionServiceAwareConverter<Cluster, ClusterV4Request> { @Override public ClusterV4Request convert(Cluster source) { ClusterV4Request clusterRequest = new ClusterV4Request(); convertClusterManager(source, clusterRequest); clusterRequest.setBlueprintName(source.getBlueprint().getName()); clusterRequest.setValidateBlueprint(null); clusterRequest.setExecutorType(source.getExecutorType()); clusterRequest.setUserName(""); clusterRequest.setPassword(""); if (source.getFileSystem() != null) { clusterRequest.setCloudStorage(cloudStorageConverter.fileSystemToRequest(source.getFileSystem())); } clusterRequest.setName(source.getName()); if (source.getRdsConfigs() != null && !source.getRdsConfigs().isEmpty()) { Set<String> databaseNames = source.getRdsConfigs().stream() .filter(rdsConfig -> rdsConfig.getStatus() == ResourceStatus.USER_MANAGED) .map(RDSConfig::getName) .collect(Collectors.toSet()); clusterRequest.setDatabases(Collections.unmodifiableSet(databaseNames)); } if (StringUtils.isNotEmpty(source.getProxyConfigCrn())) { clusterRequest.setProxyConfigCrn(source.getProxyConfigCrn()); } if (source.getGateway() != null) { clusterRequest.setGateway(getConversionService().convert(source.getGateway(), GatewayV4Request.class)); } clusterRequest.setRangerRazEnabled(source.isRangerRazEnabled()); return clusterRequest; }  @Override ClusterV4Request convert(Cluster source);  }