DefaultApplicationSlaManagementService implements ApplicationSlaManagementService { @Override public ApplicationSLA getApplicationSLA(String applicationName) { return storage.findByName(applicationName) .onErrorReturn(t -> { logger.info("Error retrieving ApplicationSLA for applicationName {}: {}", applicationName, t.getMessage()); if (logger.isDebugEnabled()) { logger.debug("Error retrieving ApplicationSLA for applicationName " + applicationName, t); } return null; }) .toBlocking() .firstOrDefault(null); } @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);  }
@Test public void testGetApplicationByName() throws Exception { ApplicationSLA myApp = ApplicationSlaSample.CriticalSmall.build(); when(storage.findByName(myApp.getAppName())).thenReturn(Observable.just(myApp)); ApplicationSLA result = slaManagementService.getApplicationSLA(myApp.getAppName()); assertThat(result.getAppName()).isEqualTo(myApp.getAppName()); assertThat(result.getSchedulerName()).isEqualTo(myApp.getSchedulerName()); }