ReadOnlySchedulerImpl implements ReadOnlyScheduler.Iface { @Override public Response populateJobConfig(JobConfiguration description) { requireNonNull(description); try { ITaskConfig populatedTaskConfig = SanitizedConfiguration.fromUnsanitized( configurationManager, IJobConfiguration.build(description)).getJobConfig().getTaskConfig(); return ok(Result.populateJobResult( new PopulateJobResult().setTaskConfig(populatedTaskConfig.newBuilder()))); } catch (TaskDescriptionException e) { return invalidRequest("Invalid configuration: " + e.getMessage()); } } @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 testPopulateJobConfig() throws Exception { IJobConfiguration job = IJobConfiguration.build(makeJob()); SanitizedConfiguration sanitized = SanitizedConfiguration.fromUnsanitized(TaskTestUtil.CONFIGURATION_MANAGER, job); control.replay(); Response response = assertOkResponse(thrift.populateJobConfig(job.newBuilder())); assertEquals( Result.populateJobResult(new PopulateJobResult( sanitized.getJobConfig().getTaskConfig().newBuilder())), response.getResult()); }
@Test public void testPopulateJobConfigFails() throws Exception { IJobConfiguration job = IJobConfiguration.build(makeJob(null)); control.replay(); assertResponse(INVALID_REQUEST, thrift.populateJobConfig(job.newBuilder())); }