use of com.aws.greengrass.componentmanager.exceptions.MissingRequiredComponentsException in project aws-greengrass-nucleus by aws-greengrass.
the class ComponentManagerTest method GIVEN_deployment_WHEN_dependency_closure_is_missing_download_prereq_component_THEN_fail.
@Test
void GIVEN_deployment_WHEN_dependency_closure_is_missing_download_prereq_component_THEN_fail() throws Exception {
ComponentIdentifier testComponent = new ComponentIdentifier("test.component", new Semver("1.0.0"));
ComponentRecipe mockRecipe = mock(ComponentRecipe.class);
Optional<ComponentRecipe> recipeResult = Optional.of(mockRecipe);
// Private ECR image
List<ComponentArtifact> artifacts = Collections.singletonList(ComponentArtifact.builder().artifactUri(new URI("s3://some/artifact")).build());
when(mockRecipe.getArtifacts()).thenReturn(artifacts);
when(componentStore.findPackageRecipe(any())).thenReturn(recipeResult);
doThrow(new MissingRequiredComponentsException("Missing required component for download")).when(artifactDownloaderFactory).checkDownloadPrerequisites(any(), any(), any());
List<ComponentIdentifier> dependencyClosure = Arrays.asList(testComponent);
assertThrows(MissingRequiredComponentsException.class, () -> componentManager.checkPreparePackagesPrerequisites(dependencyClosure));
}
Aggregations