@Test public void testValidConfiguration() { MapConfig config = new MapConfig(CollectionsExt.merge( TokenBucketTestConfigurations.NOT_SHARED_PROPERTIES, SHARED_ANY_PROPERTIES )); ArchaiusTokenBucketAdmissionConfigurationParser parser = new ArchaiusTokenBucketAdmissionConfigurationParser(config); List<TokenBucketConfiguration> configuration = parser.get(); assertThat(configuration).hasSize(2); assertThat(configuration.get(0)).isEqualTo(TokenBucketTestConfigurations.NOT_SHARED_CONFIGURATION); assertThat(configuration.get(1)).isEqualTo(TokenBucketTestConfigurations.SHARED_ANY_CONFIGURATION); }
public List<TokenBucketConfiguration> get() { List<TokenBucketConfiguration> currentConfiguration = parseToBucketConfiguration(); currentConfiguration.sort(Comparator.comparingInt(TokenBucketConfiguration::getOrder)); if (currentConfiguration.equals(bucketConfigurations)) { return bucketConfigurations; } return this.bucketConfigurations = currentConfiguration; }
ArchaiusTokenBucketAdmissionConfigurationParser implements Supplier<List<TokenBucketConfiguration>> { public List<TokenBucketConfiguration> get() { List<TokenBucketConfiguration> currentConfiguration = parseToBucketConfiguration(); currentConfiguration.sort(Comparator.comparingInt(TokenBucketConfiguration::getOrder)); if (currentConfiguration.equals(bucketConfigurations)) { return bucketConfigurations; } return this.bucketConfigurations = currentConfiguration; } }
ArchaiusTokenBucketAdmissionConfigurationParser implements Supplier<List<TokenBucketConfiguration>> { public List<TokenBucketConfiguration> get() { List<TokenBucketConfiguration> currentConfiguration = parseToBucketConfiguration(); currentConfiguration.sort(Comparator.comparingInt(TokenBucketConfiguration::getOrder)); if (currentConfiguration.equals(bucketConfigurations)) { return bucketConfigurations; } return this.bucketConfigurations = currentConfiguration; } ArchaiusTokenBucketAdmissionConfigurationParser(Config config); }
ArchaiusTokenBucketAdmissionConfigurationParser implements Supplier<List<TokenBucketConfiguration>> { public List<TokenBucketConfiguration> get() { List<TokenBucketConfiguration> currentConfiguration = parseToBucketConfiguration(); currentConfiguration.sort(Comparator.comparingInt(TokenBucketConfiguration::getOrder)); if (currentConfiguration.equals(bucketConfigurations)) { return bucketConfigurations; } return this.bucketConfigurations = currentConfiguration; } ArchaiusTokenBucketAdmissionConfigurationParser(Config config); List<TokenBucketConfiguration> get(); }
ArchaiusTokenBucketAdmissionConfigurationParser implements Supplier<List<TokenBucketConfiguration>> { public List<TokenBucketConfiguration> get() { List<TokenBucketConfiguration> currentConfiguration = parseToBucketConfiguration(); currentConfiguration.sort(Comparator.comparingInt(TokenBucketConfiguration::getOrder)); if (currentConfiguration.equals(bucketConfigurations)) { return bucketConfigurations; } return this.bucketConfigurations = currentConfiguration; } ArchaiusTokenBucketAdmissionConfigurationParser(Config config); List<TokenBucketConfiguration> get();  }