use of com.aws.greengrass.componentmanager.ComponentManager in project aws-greengrass-nucleus by aws-greengrass.
the class DeploymentTaskIntegrationTest method setupKernel.
@BeforeAll
static void setupKernel() throws IOException {
kernel = new Kernel();
rootDir = Paths.get(System.getProperty("root"));
NoOpPathOwnershipHandler.register(kernel);
ConfigPlatformResolver.initKernelWithMultiPlatformConfig(kernel, DeploymentTaskIntegrationTest.class.getResource("onlyMain.yaml"));
kernel.launch();
// get required instances from context
componentManager = kernel.getContext().get(ComponentManager.class);
componentStore = kernel.getContext().get(ComponentStore.class);
dependencyResolver = kernel.getContext().get(DependencyResolver.class);
kernelConfigResolver = kernel.getContext().get(KernelConfigResolver.class);
deploymentConfigMerger = kernel.getContext().get(DeploymentConfigMerger.class);
deploymentDocumentDownloader = kernel.getContext().get(DeploymentDocumentDownloader.class);
thingGroupHelper = kernel.getContext().get(ThingGroupHelper.class);
}
use of com.aws.greengrass.componentmanager.ComponentManager 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);
}
use of com.aws.greengrass.componentmanager.ComponentManager in project aws-greengrass-nucleus by aws-greengrass.
the class PluginComponentTest method submitSampleJobDocument.
private static Future<DeploymentResult> submitSampleJobDocument(DeploymentDocument sampleJobDocument, Kernel kernel) {
ComponentManager componentManager = kernel.getContext().get(ComponentManager.class);
DependencyResolver dependencyResolver = kernel.getContext().get(DependencyResolver.class);
KernelConfigResolver kernelConfigResolver = kernel.getContext().get(KernelConfigResolver.class);
DeploymentConfigMerger deploymentConfigMerger = kernel.getContext().get(DeploymentConfigMerger.class);
DeploymentDocumentDownloader deploymentDocumentDownloader = kernel.getContext().get(DeploymentDocumentDownloader.class);
DefaultDeploymentTask deploymentTask = new DefaultDeploymentTask(dependencyResolver, componentManager, kernelConfigResolver, deploymentConfigMerger, LogManager.getLogger("Deployer"), new Deployment(sampleJobDocument, Deployment.DeploymentType.IOT_JOBS, "jobId", DEFAULT), Topics.of(kernel.getContext(), DeploymentService.DEPLOYMENT_SERVICE_TOPICS, null), kernel.getContext().get(ExecutorService.class), deploymentDocumentDownloader, thingGroupHelper);
return kernel.getContext().get(ExecutorService.class).submit(deploymentTask);
}
Aggregations