use of software.amazon.awssdk.aws.greengrass.model.SendConfigurationValidityReportResponse in project aws-greengrass-nucleus by aws-greengrass.
the class ConfigStoreIPCEventStreamAgentTest method GIVEN_validation_event_being_tracked_WHEN_send_config_validity_report_request_THEN_notify_validation_requester.
@Test
void GIVEN_validation_event_being_tracked_WHEN_send_config_validity_report_request_THEN_notify_validation_requester() throws Exception {
when(mockAuthenticationData.getIdentityLabel()).thenReturn(TEST_COMPONENT_A);
when(mockServerConnectionContinuation.sendMessage(anyList(), byteArrayCaptor.capture(), any(MessageType.class), anyInt())).thenReturn(new CompletableFuture<>());
SubscribeToValidateConfigurationUpdatesRequest request = new SubscribeToValidateConfigurationUpdatesRequest();
SubscribeToValidateConfigurationUpdatesResponse response = agent.getValidateConfigurationUpdatesHandler(mockContext).handleRequest(request);
assertNotNull(response);
Map<String, Object> configToValidate = new HashMap<>();
configToValidate.put(TEST_CONFIG_KEY_1, 0);
configToValidate.put(TEST_CONFIG_KEY_2, 100);
CompletableFuture<ConfigurationValidityReport> validationTracker = new CompletableFuture<>();
assertTrue(agent.validateConfiguration(TEST_COMPONENT_A, "A", configToValidate, validationTracker));
SendConfigurationValidityReportRequest reportRequest = new SendConfigurationValidityReportRequest();
ConfigurationValidityReport validityReport = new ConfigurationValidityReport();
validityReport.setStatus(ConfigurationValidityStatus.ACCEPTED);
validityReport.setDeploymentId("A");
reportRequest.setConfigurationValidityReport(validityReport);
SendConfigurationValidityReportResponse reportResponse = agent.getSendConfigurationValidityReportHandler(mockContext).handleRequest(reportRequest);
assertNotNull(reportResponse);
assertTrue(validationTracker.isDone());
assertEquals(ConfigurationValidityStatus.ACCEPTED, validationTracker.get().getStatus());
}
Aggregations