use of software.amazon.awssdk.iot.iotjobs.model.JobExecutionSummary in project aws-iot-device-sdk-java-v2 by aws.
the class JobsSample method onGetPendingJobExecutionsAccepted.
static void onGetPendingJobExecutionsAccepted(GetPendingJobExecutionsResponse response) {
System.out.println("Pending Jobs: " + (response.queuedJobs.size() + response.inProgressJobs.size() == 0 ? "none" : ""));
for (JobExecutionSummary job : response.inProgressJobs) {
availableJobs.add(job.jobId);
System.out.println(" In Progress: " + job.jobId + " @ " + job.lastUpdatedAt.toString());
}
for (JobExecutionSummary job : response.queuedJobs) {
availableJobs.add(job.jobId);
System.out.println(" " + job.jobId + " @ " + job.lastUpdatedAt.toString());
}
gotResponse.complete(null);
}
use of software.amazon.awssdk.iot.iotjobs.model.JobExecutionSummary in project aws-greengrass-nucleus by aws-greengrass.
the class IotJobsHelperTest method GIVEN_connected_to_iot_WHEN_subscribe_to_jobs_topics_THEN_get_notification_for_queued_jobs.
@Test
void GIVEN_connected_to_iot_WHEN_subscribe_to_jobs_topics_THEN_get_notification_for_queued_jobs() throws Exception {
iotJobsHelper.postInject();
CompletableFuture<Integer> integerCompletableFuture = CompletableFuture.completedFuture(1);
when(mockIotJobsClientWrapper.SubscribeToJobExecutionsChangedEvents(any(), eq(QualityOfService.AT_LEAST_ONCE), any())).thenReturn(integerCompletableFuture);
when(mockIotJobsClientWrapper.SubscribeToDescribeJobExecutionAccepted(any(), eq(QualityOfService.AT_LEAST_ONCE), any())).thenReturn(integerCompletableFuture);
when(mockIotJobsClientWrapper.SubscribeToDescribeJobExecutionRejected(any(), eq(QualityOfService.AT_LEAST_ONCE), any())).thenReturn(integerCompletableFuture);
iotJobsHelper.subscribeToJobsTopics();
verify(mockIotJobsClientWrapper, times(2)).SubscribeToJobExecutionsChangedEvents(any(), eq(QualityOfService.AT_LEAST_ONCE), eventChangeResponseCaptor.capture());
JobExecutionsChangedEvent event = new JobExecutionsChangedEvent();
HashMap<JobStatus, List<JobExecutionSummary>> jobs = new HashMap<>();
jobs.put(JobStatus.QUEUED, Arrays.asList(new JobExecutionSummary()));
event.jobs = jobs;
eventChangeResponseCaptor.getValue().accept(event);
verify(mockIotJobsClientWrapper, times(3)).PublishDescribeJobExecution(any(), eq(QualityOfService.AT_LEAST_ONCE));
}
use of software.amazon.awssdk.iot.iotjobs.model.JobExecutionSummary in project aws-greengrass-nucleus by aws-greengrass.
the class IotJobsHelperTest method GIVEN_connected_to_iot_WHEN_subscribe_to_jobs_topics_THEN_get_notification_for_in_progress_jobs.
@Test
void GIVEN_connected_to_iot_WHEN_subscribe_to_jobs_topics_THEN_get_notification_for_in_progress_jobs() throws Exception {
iotJobsHelper.postInject();
CompletableFuture<Integer> integerCompletableFuture = CompletableFuture.completedFuture(1);
when(mockIotJobsClientWrapper.SubscribeToJobExecutionsChangedEvents(any(), eq(QualityOfService.AT_LEAST_ONCE), any())).thenReturn(integerCompletableFuture);
when(mockIotJobsClientWrapper.SubscribeToDescribeJobExecutionAccepted(any(), eq(QualityOfService.AT_LEAST_ONCE), any())).thenReturn(integerCompletableFuture);
when(mockIotJobsClientWrapper.SubscribeToDescribeJobExecutionRejected(any(), eq(QualityOfService.AT_LEAST_ONCE), any())).thenReturn(integerCompletableFuture);
iotJobsHelper.subscribeToJobsTopics();
verify(mockIotJobsClientWrapper, times(2)).SubscribeToJobExecutionsChangedEvents(any(), eq(QualityOfService.AT_LEAST_ONCE), eventChangeResponseCaptor.capture());
JobExecutionsChangedEvent event = new JobExecutionsChangedEvent();
HashMap<JobStatus, List<JobExecutionSummary>> jobs = new HashMap<>();
jobs.put(JobStatus.IN_PROGRESS, Arrays.asList(new JobExecutionSummary()));
event.jobs = jobs;
eventChangeResponseCaptor.getValue().accept(event);
verify(mockIotJobsClientWrapper, times(2)).PublishDescribeJobExecution(any(), eq(QualityOfService.AT_LEAST_ONCE));
}
Aggregations