@Test public void testWithVersion250() { Set<CloudStorageSupportedV4Response> matrix = underTest.getCloudStorageMatrix("2.5.0"); assertTrue(matrix.isEmpty()); }
public Set<CloudStorageSupportedV4Response> getCloudStorageMatrix(String stackVersion) { VersionComparator versionComparator = new VersionComparator(); Set<CloudStorageSupportedV4Response> response = new HashSet<>(); cloudFileSystemSupportMatrix.getProviders().forEach(supportConfigEntries -> { Set<String> supportedFileSystems = supportConfigEntries.getConfigEntries().stream() .filter(supportConfigEntry -> { Versioned minVersion = supportConfigEntry::getMinVersion; Versioned currentVersion = () -> stackVersion.length() > supportConfigEntry.getMinVersion().length() ? stackVersion.substring(0, supportConfigEntry.getMinVersion().length()) : stackVersion; int compared = versionComparator.compare(minVersion, currentVersion); return compared <= 0; }) .map(CloudFileSystemSupportConfigEntry::getSupportedFileSytem) .collect(Collectors.toSet()); if (!supportedFileSystems.isEmpty()) { CloudStorageSupportedV4Response cloudStorageSupportedV4Response = new CloudStorageSupportedV4Response(); cloudStorageSupportedV4Response.setProvider(supportConfigEntries.getProvider()); cloudStorageSupportedV4Response.setFileSystemType(supportedFileSystems); response.add(cloudStorageSupportedV4Response); } }); return response; }
FileSystemSupportMatrixService { public Set<CloudStorageSupportedV4Response> getCloudStorageMatrix(String stackVersion) { VersionComparator versionComparator = new VersionComparator(); Set<CloudStorageSupportedV4Response> response = new HashSet<>(); cloudFileSystemSupportMatrix.getProviders().forEach(supportConfigEntries -> { Set<String> supportedFileSystems = supportConfigEntries.getConfigEntries().stream() .filter(supportConfigEntry -> { Versioned minVersion = supportConfigEntry::getMinVersion; Versioned currentVersion = () -> stackVersion.length() > supportConfigEntry.getMinVersion().length() ? stackVersion.substring(0, supportConfigEntry.getMinVersion().length()) : stackVersion; int compared = versionComparator.compare(minVersion, currentVersion); return compared <= 0; }) .map(CloudFileSystemSupportConfigEntry::getSupportedFileSytem) .collect(Collectors.toSet()); if (!supportedFileSystems.isEmpty()) { CloudStorageSupportedV4Response cloudStorageSupportedV4Response = new CloudStorageSupportedV4Response(); cloudStorageSupportedV4Response.setProvider(supportConfigEntries.getProvider()); cloudStorageSupportedV4Response.setFileSystemType(supportedFileSystems); response.add(cloudStorageSupportedV4Response); } }); return response; } }
FileSystemSupportMatrixService { public Set<CloudStorageSupportedV4Response> getCloudStorageMatrix(String stackVersion) { VersionComparator versionComparator = new VersionComparator(); Set<CloudStorageSupportedV4Response> response = new HashSet<>(); cloudFileSystemSupportMatrix.getProviders().forEach(supportConfigEntries -> { Set<String> supportedFileSystems = supportConfigEntries.getConfigEntries().stream() .filter(supportConfigEntry -> { Versioned minVersion = supportConfigEntry::getMinVersion; Versioned currentVersion = () -> stackVersion.length() > supportConfigEntry.getMinVersion().length() ? stackVersion.substring(0, supportConfigEntry.getMinVersion().length()) : stackVersion; int compared = versionComparator.compare(minVersion, currentVersion); return compared <= 0; }) .map(CloudFileSystemSupportConfigEntry::getSupportedFileSytem) .collect(Collectors.toSet()); if (!supportedFileSystems.isEmpty()) { CloudStorageSupportedV4Response cloudStorageSupportedV4Response = new CloudStorageSupportedV4Response(); cloudStorageSupportedV4Response.setProvider(supportConfigEntries.getProvider()); cloudStorageSupportedV4Response.setFileSystemType(supportedFileSystems); response.add(cloudStorageSupportedV4Response); } }); return response; }  }
FileSystemSupportMatrixService { public Set<CloudStorageSupportedV4Response> getCloudStorageMatrix(String stackVersion) { VersionComparator versionComparator = new VersionComparator(); Set<CloudStorageSupportedV4Response> response = new HashSet<>(); cloudFileSystemSupportMatrix.getProviders().forEach(supportConfigEntries -> { Set<String> supportedFileSystems = supportConfigEntries.getConfigEntries().stream() .filter(supportConfigEntry -> { Versioned minVersion = supportConfigEntry::getMinVersion; Versioned currentVersion = () -> stackVersion.length() > supportConfigEntry.getMinVersion().length() ? stackVersion.substring(0, supportConfigEntry.getMinVersion().length()) : stackVersion; int compared = versionComparator.compare(minVersion, currentVersion); return compared <= 0; }) .map(CloudFileSystemSupportConfigEntry::getSupportedFileSytem) .collect(Collectors.toSet()); if (!supportedFileSystems.isEmpty()) { CloudStorageSupportedV4Response cloudStorageSupportedV4Response = new CloudStorageSupportedV4Response(); cloudStorageSupportedV4Response.setProvider(supportConfigEntries.getProvider()); cloudStorageSupportedV4Response.setFileSystemType(supportedFileSystems); response.add(cloudStorageSupportedV4Response); } }); return response; }  @PostConstruct void init(); Set<CloudStorageSupportedV4Response> getCloudStorageMatrix(String stackVersion); }
FileSystemSupportMatrixService { public Set<CloudStorageSupportedV4Response> getCloudStorageMatrix(String stackVersion) { VersionComparator versionComparator = new VersionComparator(); Set<CloudStorageSupportedV4Response> response = new HashSet<>(); cloudFileSystemSupportMatrix.getProviders().forEach(supportConfigEntries -> { Set<String> supportedFileSystems = supportConfigEntries.getConfigEntries().stream() .filter(supportConfigEntry -> { Versioned minVersion = supportConfigEntry::getMinVersion; Versioned currentVersion = () -> stackVersion.length() > supportConfigEntry.getMinVersion().length() ? stackVersion.substring(0, supportConfigEntry.getMinVersion().length()) : stackVersion; int compared = versionComparator.compare(minVersion, currentVersion); return compared <= 0; }) .map(CloudFileSystemSupportConfigEntry::getSupportedFileSytem) .collect(Collectors.toSet()); if (!supportedFileSystems.isEmpty()) { CloudStorageSupportedV4Response cloudStorageSupportedV4Response = new CloudStorageSupportedV4Response(); cloudStorageSupportedV4Response.setProvider(supportConfigEntries.getProvider()); cloudStorageSupportedV4Response.setFileSystemType(supportedFileSystems); response.add(cloudStorageSupportedV4Response); } }); return response; }  @PostConstruct void init(); Set<CloudStorageSupportedV4Response> getCloudStorageMatrix(String stackVersion);  }