@Test public void getRoster () { platform.getRoster(); platform.getRoster(); verify(platform, times(1)).generateRoster(); assertThat(platform.getRoster(), IsIterableContainingInAnyOrder.containsInAnyOrder(container)); }
public synchronized List<Container> getRoster () { try (MDC.MDCCloseable ignored = MDC.putCloseable(DataDogConstants.DATADOG_PLATFORM_KEY, this.getPlatformType())) { if (roster == null) { roster = new Expiring<>(generateRoster(), ROSTER_CACHE_DURATION); } return roster.computeIfAbsent(this::generateRoster, ROSTER_CACHE_DURATION); } }
Platform implements ExperimentalObject { public synchronized List<Container> getRoster () { try (MDC.MDCCloseable ignored = MDC.putCloseable(DataDogConstants.DATADOG_PLATFORM_KEY, this.getPlatformType())) { if (roster == null) { roster = new Expiring<>(generateRoster(), ROSTER_CACHE_DURATION); } return roster.computeIfAbsent(this::generateRoster, ROSTER_CACHE_DURATION); } } }
Platform implements ExperimentalObject { public synchronized List<Container> getRoster () { try (MDC.MDCCloseable ignored = MDC.putCloseable(DataDogConstants.DATADOG_PLATFORM_KEY, this.getPlatformType())) { if (roster == null) { roster = new Expiring<>(generateRoster(), ROSTER_CACHE_DURATION); } return roster.computeIfAbsent(this::generateRoster, ROSTER_CACHE_DURATION); } }  }
Platform implements ExperimentalObject { public synchronized List<Container> getRoster () { try (MDC.MDCCloseable ignored = MDC.putCloseable(DataDogConstants.DATADOG_PLATFORM_KEY, this.getPlatformType())) { if (roster == null) { roster = new Expiring<>(generateRoster(), ROSTER_CACHE_DURATION); } return roster.computeIfAbsent(this::generateRoster, ROSTER_CACHE_DURATION); } }  void setAverageMillisPerExperiment(long averageMillisPerExperiment); void expireCachedRoster(); abstract ApiStatus getApiStatus(); abstract PlatformLevel getPlatformLevel(); abstract PlatformHealth getPlatformHealth(); double getDestructionProbability(); String getPlatformType(); synchronized List<Container> getRoster(); Collection<Container> getRosterByAggregationId(String aggregationId); @Override synchronized boolean canExperiment(); Instant getNextChaosTime(); Platform scheduleExperiment(); @SuppressWarnings("unused") // get methods are consumed by Spring Rest. Set<Date> getExperimentTimes(); @JsonIgnore Duration getMinimumSelfHealingInterval(); List<Container> generateExperimentRoster(); abstract boolean isContainerRecycled(Container container); boolean hasEligibleContainersForExperiments(); Container getContainerByIdentifier(String containerIdentifier); }
Platform implements ExperimentalObject { public synchronized List<Container> getRoster () { try (MDC.MDCCloseable ignored = MDC.putCloseable(DataDogConstants.DATADOG_PLATFORM_KEY, this.getPlatformType())) { if (roster == null) { roster = new Expiring<>(generateRoster(), ROSTER_CACHE_DURATION); } return roster.computeIfAbsent(this::generateRoster, ROSTER_CACHE_DURATION); } }  void setAverageMillisPerExperiment(long averageMillisPerExperiment); void expireCachedRoster(); abstract ApiStatus getApiStatus(); abstract PlatformLevel getPlatformLevel(); abstract PlatformHealth getPlatformHealth(); double getDestructionProbability(); String getPlatformType(); synchronized List<Container> getRoster(); Collection<Container> getRosterByAggregationId(String aggregationId); @Override synchronized boolean canExperiment(); Instant getNextChaosTime(); Platform scheduleExperiment(); @SuppressWarnings("unused") // get methods are consumed by Spring Rest. Set<Date> getExperimentTimes(); @JsonIgnore Duration getMinimumSelfHealingInterval(); List<Container> generateExperimentRoster(); abstract boolean isContainerRecycled(Container container); boolean hasEligibleContainersForExperiments(); Container getContainerByIdentifier(String containerIdentifier);  }