ReadOnlySchedulerImpl implements ReadOnlyScheduler.Iface { @Override public Response getJobUpdateDetails(JobUpdateKey mutableKey) { IJobUpdateKey key = IJobUpdateKey.build(mutableKey); Optional<IJobUpdateDetails> details = storage.read(storeProvider -> storeProvider.getJobUpdateStore().fetchJobUpdateDetails(key)); if (details.isPresent()) { return ok(Result.getJobUpdateDetailsResult( new GetJobUpdateDetailsResult().setDetails(details.get().newBuilder()))); } else { return invalidRequest("Invalid update: " + key); } } @Inject  ReadOnlySchedulerImpl(
      ConfigurationManager configurationManager,
      Storage storage,
      NearestFit nearestFit,
      CronPredictor cronPredictor,
      QuotaManager quotaManager); @Override Response populateJobConfig(JobConfiguration description); @Override Response getTasksStatus(TaskQuery query); @Override Response getTasksWithoutConfigs(TaskQuery query); @Override Response getPendingReason(TaskQuery query); @Override Response getConfigSummary(JobKey job); @Override Response getRoleSummary(); @Override Response getJobSummary(@Nullable String maybeNullRole); @Override Response getJobs(@Nullable String maybeNullRole); @Override Response getQuota(String ownerRole); @Override Response getJobUpdateSummaries(JobUpdateQuery mutableQuery); @Override Response getJobUpdateDetails(JobUpdateKey mutableKey); @Override Response getJobUpdateDiff(JobUpdateRequest mutableRequest);  }
@Test public void testGetJobUpdateDetails() throws Exception { JobUpdateDetails details = createJobUpdateDetails(); expect(storageUtil.jobUpdateStore.fetchJobUpdateDetails(UPDATE_KEY)) .andReturn(Optional.of(IJobUpdateDetails.build(details))); control.replay(); Response response = assertOkResponse(thrift.getJobUpdateDetails(UPDATE_KEY.newBuilder())); assertEquals( IJobUpdateDetails.build(details), IJobUpdateDetails.build(response.getResult().getGetJobUpdateDetailsResult().getDetails())); }
@Test public void testGetJobUpdateDetailsInvalidId() throws Exception { expect(storageUtil.jobUpdateStore.fetchJobUpdateDetails(UPDATE_KEY)) .andReturn(Optional.absent()); control.replay(); assertResponse(INVALID_REQUEST, thrift.getJobUpdateDetails(UPDATE_KEY.newBuilder())); }