ReadOnlySchedulerImpl implements ReadOnlyScheduler.Iface { @Override public Response getQuota(String ownerRole) { MorePreconditions.checkNotBlank(ownerRole); return storage.read(storeProvider -> { QuotaInfo quotaInfo = quotaManager.getQuotaInfo(ownerRole, storeProvider); GetQuotaResult result = new GetQuotaResult(quotaInfo.getQuota().newBuilder()) .setProdSharedConsumption(quotaInfo.getProdSharedConsumption().newBuilder()) .setProdDedicatedConsumption(quotaInfo.getProdDedicatedConsumption().newBuilder()) .setNonProdSharedConsumption(quotaInfo.getNonProdSharedConsumption().newBuilder()) .setNonProdDedicatedConsumption( quotaInfo.getNonProdDedicatedConsumption().newBuilder()); return ok(Result.getQuotaResult(result)); }); } @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 testGetQuota() throws Exception { QuotaInfo infoMock = createMock(QuotaInfo.class); expect(quotaManager.getQuotaInfo(ROLE, storageUtil.storeProvider)).andReturn(infoMock); expect(infoMock.getQuota()).andReturn(QUOTA); expect(infoMock.getProdSharedConsumption()).andReturn(XLARGE); expect(infoMock.getProdDedicatedConsumption()).andReturn(LARGE); expect(infoMock.getNonProdSharedConsumption()).andReturn(MEDIUM); expect(infoMock.getNonProdDedicatedConsumption()).andReturn(SMALL); control.replay(); GetQuotaResult expected = new GetQuotaResult() .setQuota(QUOTA.newBuilder()) .setProdSharedConsumption(XLARGE.newBuilder()) .setProdDedicatedConsumption(LARGE.newBuilder()) .setNonProdSharedConsumption(MEDIUM.newBuilder()) .setNonProdDedicatedConsumption(SMALL.newBuilder()); Response response = assertOkResponse(thrift.getQuota(ROLE)); assertEquals(expected, response.getResult().getGetQuotaResult()); }