use of software.amazon.awssdk.aws.greengrass.model.DeferComponentUpdateResponse in project aws-greengrass-nucleus by aws-greengrass.
the class LifecycleIPCEventStreamAgentTest method testUpdateStateHandler_subscribe_then_defer.
@Test
@SuppressWarnings("PMD.CloseResource")
void testUpdateStateHandler_subscribe_then_defer() throws ExecutionException, InterruptedException {
SubscribeToComponentUpdatesRequest subsRequest = new SubscribeToComponentUpdatesRequest();
LifecycleIPCEventStreamAgent.SubscribeToComponentUpdateOperationHandler handler = lifecycleIPCEventStreamAgent.getSubscribeToComponentUpdateHandler(mockContext);
SubscribeToComponentUpdatesResponse response = handler.handleRequest(subsRequest);
assertNotNull(response);
CompletableFuture<DeferComponentUpdateRequest> deferFuture = new CompletableFuture<>();
lifecycleIPCEventStreamAgent.getDeferUpdateFuturesMap().put(new Pair<>(TEST_SERVICE, "A"), deferFuture);
DeferComponentUpdateRequest deferComponentUpdateRequest = new DeferComponentUpdateRequest();
deferComponentUpdateRequest.setMessage("Test defer");
deferComponentUpdateRequest.setDeploymentId("A");
deferComponentUpdateRequest.setRecheckAfterMs(1000L);
DeferComponentUpdateResponse response1 = lifecycleIPCEventStreamAgent.getDeferComponentHandler(mockContext).handleRequest(deferComponentUpdateRequest);
assertNotNull(response1);
DeferComponentUpdateRequest request = deferFuture.get();
assertEquals("A", request.getDeploymentId());
assertEquals("Test defer", request.getMessage());
assertEquals(1000L, request.getRecheckAfterMs());
assertFalse(lifecycleIPCEventStreamAgent.getDeferUpdateFuturesMap().containsKey(new Pair<>(TEST_SERVICE, "A")));
}
Aggregations