use of software.amazon.awssdk.iot.iotjobs.model.JobStatus 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.JobStatus 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