public long getJobsCount(List<NamespaceKey> datasetPaths) { long jobCount = 0; for (Integer count : jobsService.getJobsCount(datasetPaths)) { if (count != null) { jobCount += count; } } return jobCount; }
public int getJobsCount(NamespaceKey path) { return jobsService.getJobsCount(path); }
public static void checkJobsCountForDatasets(int count, DatasetPath ...datasetPaths) throws Exception { for (DatasetPath datasetPath : datasetPaths) { assertEquals(datasetPath.toPathString(), count, jobsService.getJobsCount(datasetPath.toNamespaceKey())); } }
@BeforeClass public static void setup() throws Exception { clearAllDataExceptUser(); populateInitialData(); for (DatasetPath datasetPath : allDatasets) { jobsCount.put(datasetPath, jobsService.getJobsCount(datasetPath.toNamespaceKey())); } }
public static void checkJobsCountForAllDatasets(int count) throws Exception { for (DatasetPath datasetPath : allDatasets) { assertEquals(datasetPath.toPathString(), count, jobsService.getJobsCount(datasetPath.toNamespaceKey())); } }
public static void checkJobsCountForDataset(int count, DatasetPath datasetPath) throws Exception { assertEquals(datasetPath.toPathString(), count, jobsService.getJobsCount(datasetPath.toNamespaceKey())); }
@Test public void testDsg10External() { Job job = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(new SqlQuery("select * from DG.dsg10", SampleDataPopulator.DEFAULT_USER_NAME)) .setQueryType(QueryType.UI_RUN) .build(), NoOpJobStatusListener.INSTANCE); job.getData().loadIfNecessary(); assertEquals(inc(dsg10), jobsService.getJobsCount(dsg10.toNamespaceKey())); assertEquals(inc(dsg9), jobsService.getJobsCount(dsg9.toNamespaceKey())); assertEquals(inc(dsg8), jobsService.getJobsCount(dsg8.toNamespaceKey())); assertEquals(inc(dsg3), jobsService.getJobsCount(dsg3.toNamespaceKey())); assertEquals(inc(dsg2), jobsService.getJobsCount(dsg2.toNamespaceKey())); assertEquals(inc(dsg4), jobsService.getJobsCount(dsg4.toNamespaceKey())); assertEquals(inc(dsg1), jobsService.getJobsCount(dsg1.toNamespaceKey())); assertEquals(inc(sample1), jobsService.getJobsCount(sample1.toNamespaceKey())); assertEquals(inc(sample2), jobsService.getJobsCount(sample2.toNamespaceKey())); assertEquals((int) jobsCount.get(dsg5), jobsService.getJobsCount(dsg5.toNamespaceKey())); assertEquals((int)jobsCount.get(dsg6), jobsService.getJobsCount(dsg6.toNamespaceKey())); assertEquals((int)jobsCount.get(dsg7), jobsService.getJobsCount(dsg7.toNamespaceKey())); }
@Test public void testDsg1Unknown() { Job job = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(new SqlQuery("select * from DG.dsg1", SampleDataPopulator.DEFAULT_USER_NAME)) .setQueryType(QueryType.UNKNOWN) .build(), NoOpJobStatusListener.INSTANCE); job.getData().loadIfNecessary(); // unkown jobs are not counted assertEquals((int)jobsCount.get(dsg1), jobsService.getJobsCount(dsg1.toNamespaceKey())); assertEquals((int) jobsCount.get(sample1), jobsService.getJobsCount(sample1.toNamespaceKey())); }
@Test public void testDsg2Internal() { Job job = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(new SqlQuery("select * from DG.dsg2", SampleDataPopulator.DEFAULT_USER_NAME)) .setQueryType(QueryType.UI_INTERNAL_PREVIEW) .build(), NoOpJobStatusListener.INSTANCE); job.getData().loadIfNecessary(); // internal jobs don't get counted assertEquals((int) jobsCount.get(dsg2), jobsService.getJobsCount(dsg2.toNamespaceKey())); assertEquals((int) jobsCount.get(sample2), jobsService.getJobsCount(sample2.toNamespaceKey())); }
@Test public void testDsg2UI() { Job job = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(new SqlQuery("select * from DG.dsg2", SampleDataPopulator.DEFAULT_USER_NAME)) .setQueryType(QueryType.UI_RUN) .build(), NoOpJobStatusListener.INSTANCE); job.getData().loadIfNecessary(); assertEquals(inc(dsg2), jobsService.getJobsCount(dsg2.toNamespaceKey())); assertEquals(inc(sample2), jobsService.getJobsCount(sample2.toNamespaceKey())); }
@Test public void testDsg1External() { Job job = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(new SqlQuery("select * from DG.dsg1", SampleDataPopulator.DEFAULT_USER_NAME)) .setQueryType(QueryType.UI_RUN) .build(), NoOpJobStatusListener.INSTANCE); job.getData().loadIfNecessary(); assertEquals(inc(dsg1), jobsService.getJobsCount(dsg1.toNamespaceKey())); assertEquals(inc(sample1), jobsService.getJobsCount(sample1.toNamespaceKey())); }