@Test public void testGetApplicationBySchedulerNameFailure() { ApplicationSLA myApp = ApplicationSlaSample.CriticalSmallKubeScheduler.build(); Observable observable = Observable.error(new RuntimeException("generic failure")); when(storage.findBySchedulerName(myApp.getSchedulerName())).thenReturn(observable); assertThatThrownBy(() -> slaManagementService.getApplicationSLAsForScheduler(myApp.getSchedulerName())).isInstanceOf(RuntimeException.class).hasMessage("generic failure"); }
@Override public Collection<ApplicationSLA> getApplicationSLAsForScheduler(String schedulerName) { return storage.findBySchedulerName(schedulerName) .doOnError(t -> logger.error("Error retrieving ApplicationSLAs for schedulerName " + schedulerName, t)) .toList() .toBlocking() .firstOrDefault(Collections.emptyList()); }
DefaultApplicationSlaManagementService implements ApplicationSlaManagementService { @Override public Collection<ApplicationSLA> getApplicationSLAsForScheduler(String schedulerName) { return storage.findBySchedulerName(schedulerName) .doOnError(t -> logger.error("Error retrieving ApplicationSLAs for schedulerName " + schedulerName, t)) .toList() .toBlocking() .firstOrDefault(Collections.emptyList()); } }
DefaultApplicationSlaManagementService implements ApplicationSlaManagementService { @Override public Collection<ApplicationSLA> getApplicationSLAsForScheduler(String schedulerName) { return storage.findBySchedulerName(schedulerName) .doOnError(t -> logger.error("Error retrieving ApplicationSLAs for schedulerName " + schedulerName, t)) .toList() .toBlocking() .firstOrDefault(Collections.emptyList()); } @Inject  DefaultApplicationSlaManagementService(CapacityMonitoringService capacityMonitoringService,
                                                  ApplicationSlaStore storage,
                                                  ManagementSubsystemInitializer initializer); }
DefaultApplicationSlaManagementService implements ApplicationSlaManagementService { @Override public Collection<ApplicationSLA> getApplicationSLAsForScheduler(String schedulerName) { return storage.findBySchedulerName(schedulerName) .doOnError(t -> logger.error("Error retrieving ApplicationSLAs for schedulerName " + schedulerName, t)) .toList() .toBlocking() .firstOrDefault(Collections.emptyList()); } @Inject  DefaultApplicationSlaManagementService(CapacityMonitoringService capacityMonitoringService,
                                                  ApplicationSlaStore storage,
                                                  ManagementSubsystemInitializer initializer); @Override Collection<ApplicationSLA> getApplicationSLAs(); @Override Collection<ApplicationSLA> getApplicationSLAsForScheduler(String schedulerName); @Override Optional<ApplicationSLA> findApplicationSLA(String applicationName); @Override ApplicationSLA getApplicationSLA(String applicationName); @Override Observable<Void> addApplicationSLA(ApplicationSLA applicationSLA); @Override Observable<Void> removeApplicationSLA(String applicationName); }
DefaultApplicationSlaManagementService implements ApplicationSlaManagementService { @Override public Collection<ApplicationSLA> getApplicationSLAsForScheduler(String schedulerName) { return storage.findBySchedulerName(schedulerName) .doOnError(t -> logger.error("Error retrieving ApplicationSLAs for schedulerName " + schedulerName, t)) .toList() .toBlocking() .firstOrDefault(Collections.emptyList()); } @Inject  DefaultApplicationSlaManagementService(CapacityMonitoringService capacityMonitoringService,
                                                  ApplicationSlaStore storage,
                                                  ManagementSubsystemInitializer initializer); @Override Collection<ApplicationSLA> getApplicationSLAs(); @Override Collection<ApplicationSLA> getApplicationSLAsForScheduler(String schedulerName); @Override Optional<ApplicationSLA> findApplicationSLA(String applicationName); @Override ApplicationSLA getApplicationSLA(String applicationName); @Override Observable<Void> addApplicationSLA(ApplicationSLA applicationSLA); @Override Observable<Void> removeApplicationSLA(String applicationName);  }