/** * Execute a query and coerce the result into a java List * @param query Query to execute * @return List of jobs that matched the query. (Empty list if none did). * @throws RemoteInvocationException If the server throws an error */ private List<JobExecutionInfo> executeQuery(JobExecutionQuery query) throws RemoteInvocationException { JobExecutionQueryResult result = this.client.get(query); if (result != null && result.hasJobExecutions()) { return result.getJobExecutions(); } return Collections.emptyList(); }
@Test public void testBadGet() throws Exception { JobExecutionQuery queryByJobId = new JobExecutionQuery(); queryByJobId.setIdType(QueryIdTypeEnum.JOB_ID); queryByJobId.setId(JobExecutionQuery.Id.create(this.expected1.getJobId() + "1")); JobExecutionQueryResult result = this.client.get(queryByJobId); Assert.assertTrue(result.getJobExecutions().isEmpty()); }
@Test public void testGet() throws Exception { JobExecutionQuery queryByJobId = new JobExecutionQuery(); queryByJobId.setIdType(QueryIdTypeEnum.JOB_ID); queryByJobId.setId(JobExecutionQuery.Id.create(this.expected1.getJobId())); JobExecutionQueryResult result = this.client.get(queryByJobId); JobExecutionInfoArray jobExecutionInfos = result.getJobExecutions(); Assert.assertEquals(jobExecutionInfos.size(), 1); JobExecutionInfo actual = jobExecutionInfos.get(0); assertJobExecution(actual, this.expected1); }
/** * Execute a query and coerce the result into a java List * @param query Query to execute * @return List of jobs that matched the query. (Empty list if none did). * @throws RemoteInvocationException If the server throws an error */ private List<JobExecutionInfo> executeQuery(JobExecutionQuery query) throws RemoteInvocationException { JobExecutionQueryResult result = this.client.get(query); if (result != null && result.hasJobExecutions()) { return result.getJobExecutions(); } return Collections.emptyList(); }