Search in sources :

Example 1 with EcrAccessor

use of com.aws.greengrass.componentmanager.plugins.docker.EcrAccessor in project aws-greengrass-nucleus by aws-greengrass.

the class DockerImageArtifactDownloadTest method before.

@BeforeEach
void before() throws Exception {
    Instant credentialsExpiry = Instant.now().plusSeconds(10);
    AuthorizationData authorizationData = AuthorizationData.builder().authorizationToken(Base64.getEncoder().encodeToString("username:password".getBytes(StandardCharsets.UTF_8))).expiresAt(credentialsExpiry).build();
    GetAuthorizationTokenResponse response = GetAuthorizationTokenResponse.builder().authorizationData(authorizationData).build();
    lenient().when(ecrClient.getAuthorizationToken(any(GetAuthorizationTokenRequest.class))).thenReturn(response);
    lenient().when(dockerClient.dockerInstalled()).thenReturn(true);
    AtomicBoolean mqttOnline = new AtomicBoolean(true);
    lenient().when(mqttClient.getMqttOnline()).thenReturn(mqttOnline);
    kernel = new Kernel();
    NucleusPaths nucleusPaths = kernel.getNucleusPaths();
    nucleusPaths.setComponentStorePath(tempRootDir);
    ComponentStore store = new ComponentStore(nucleusPaths, platformResolver, recipeLoader);
    EcrAccessor ecrAccessor = new EcrAccessor(ecrClient);
    kernel.getContext().put(ComponentStore.class, store);
    kernel.getContext().put(EcrAccessor.class, ecrAccessor);
    kernel.getContext().put(DefaultDockerClient.class, dockerClient);
    kernel.getContext().put(MqttClient.class, mqttClient);
    preloadLocalStoreContent();
    componentManager = kernel.getContext().get(ComponentManager.class);
}
Also used : GetAuthorizationTokenResponse(software.amazon.awssdk.services.ecr.model.GetAuthorizationTokenResponse) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) GetAuthorizationTokenRequest(software.amazon.awssdk.services.ecr.model.GetAuthorizationTokenRequest) AuthorizationData(software.amazon.awssdk.services.ecr.model.AuthorizationData) EcrAccessor(com.aws.greengrass.componentmanager.plugins.docker.EcrAccessor) NucleusPaths(com.aws.greengrass.util.NucleusPaths) Instant(java.time.Instant) ComponentManager(com.aws.greengrass.componentmanager.ComponentManager) Kernel(com.aws.greengrass.lifecyclemanager.Kernel) ComponentStore(com.aws.greengrass.componentmanager.ComponentStore) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ComponentManager (com.aws.greengrass.componentmanager.ComponentManager)1 ComponentStore (com.aws.greengrass.componentmanager.ComponentStore)1 EcrAccessor (com.aws.greengrass.componentmanager.plugins.docker.EcrAccessor)1 Kernel (com.aws.greengrass.lifecyclemanager.Kernel)1 NucleusPaths (com.aws.greengrass.util.NucleusPaths)1 Instant (java.time.Instant)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 AuthorizationData (software.amazon.awssdk.services.ecr.model.AuthorizationData)1 GetAuthorizationTokenRequest (software.amazon.awssdk.services.ecr.model.GetAuthorizationTokenRequest)1 GetAuthorizationTokenResponse (software.amazon.awssdk.services.ecr.model.GetAuthorizationTokenResponse)1