Search in sources :

Example 21 with Kernel

use of com.aws.greengrass.lifecyclemanager.Kernel in project aws-greengrass-nucleus by aws-greengrass.

the class ServiceDependencyLifecycleTest method GIVEN_hard_dependency_WHEN_dependency_goes_through_lifecycle_events_THEN_customer_app_is_impacted.

@Test
void GIVEN_hard_dependency_WHEN_dependency_goes_through_lifecycle_events_THEN_customer_app_is_impacted() throws Throwable {
    // setup
    kernel = new Kernel();
    URL configFile = ServiceDependencyLifecycleTest.class.getResource("service_with_hard_dependency.yaml");
    ConfigPlatformResolver.initKernelWithMultiPlatformConfig(kernel, configFile);
    // WHEN_kernel_launch_THEN_customer_app_starts_after_hard_dependency_is_running
    LinkedList<ExpectedStateTransition> expectedDuringLaunch = new LinkedList<>(Arrays.asList(new ExpectedStateTransition(HardDependency, State.INSTALLED, State.STARTING), new ExpectedStateTransition(HardDependency, State.STARTING, State.RUNNING), new ExpectedStateTransition(CustomerApp, State.INSTALLED, State.STARTING), new ExpectedStateTransition(CustomerApp, State.STARTING, State.RUNNING), new ExpectedStateTransition("main", State.STOPPING, State.FINISHED)));
    testRoutine(TEST_ROUTINE_SHORT_TIMEOUT, kernel, kernel::launch, "kernel launched", expectedDuringLaunch, Collections.emptySet());
    // WHEN_dependency_removed_THEN_customer_app_stays_running
    LinkedList<ExpectedStateTransition> expectedDepRemoved = new LinkedList<>(Arrays.asList(new ExpectedStateTransition(HardDependency, State.RUNNING, State.STOPPING)));
    Set<ExpectedStateTransition> unexpectedDepRemoved = new HashSet<>(Arrays.asList(new ExpectedStateTransition(CustomerApp, State.RUNNING, State.STOPPING), new ExpectedStateTransition(CustomerApp, State.STOPPING, State.FINISHED)));
    Map<String, Object> configRemoveDep = new HashMap<String, Object>() {

        {
            put(SERVICES_NAMESPACE_TOPIC, new HashMap<String, Object>() {

                {
                    put("main", new HashMap<String, Object>() {

                        {
                            put(SERVICE_DEPENDENCIES_NAMESPACE_TOPIC, Arrays.asList(CustomerApp, DEFAULT_NUCLEUS_COMPONENT_NAME));
                        }
                    });
                    put(CustomerApp, new HashMap<String, Object>() {

                        {
                            putAll(kernel.findServiceTopic(CustomerApp).toPOJO());
                            put(SERVICE_DEPENDENCIES_NAMESPACE_TOPIC, Collections.emptyList());
                        }
                    });
                    put(DEFAULT_NUCLEUS_COMPONENT_NAME, new HashMap<String, Object>() {

                        {
                            putAll(kernel.findServiceTopic(DEFAULT_NUCLEUS_COMPONENT_NAME).toPOJO());
                        }
                    });
                }
            });
        }
    };
    DeploymentConfigMerger configMerger = kernel.getContext().get(DeploymentConfigMerger.class);
    DeploymentDocument doc1 = mock(DeploymentDocument.class);
    when(doc1.getTimestamp()).thenReturn(System.currentTimeMillis());
    when(doc1.getDeploymentId()).thenReturn("removeHardDep");
    when(doc1.getFailureHandlingPolicy()).thenReturn(FailureHandlingPolicy.DO_NOTHING);
    testRoutine(TEST_ROUTINE_LONG_TIMEOUT, kernel, () -> configMerger.mergeInNewConfig(createMockDeployment(doc1), configRemoveDep).get(60, TimeUnit.SECONDS), "dependency removed", expectedDepRemoved, unexpectedDepRemoved);
    // WHEN_dependency_added_THEN_customer_app_restarts
    LinkedList<ExpectedStateTransition> expectedDepAdded = new LinkedList<>(Arrays.asList(new ExpectedStateTransition(CustomerApp, State.RUNNING, State.STOPPING), new ExpectedStateTransition(CustomerApp, State.STARTING, State.RUNNING)));
    Map<String, Object> configAddDep = ConfigPlatformResolver.resolvePlatformMap(configFile);
    DeploymentDocument doc2 = mock(DeploymentDocument.class);
    when(doc2.getTimestamp()).thenReturn(System.currentTimeMillis());
    when(doc2.getDeploymentId()).thenReturn("addHardDep");
    when(doc2.getFailureHandlingPolicy()).thenReturn(FailureHandlingPolicy.DO_NOTHING);
    testRoutine(60, kernel, () -> configMerger.mergeInNewConfig(createMockDeployment(doc2), configAddDep).get(10, TimeUnit.SECONDS), "dependency added", expectedDepAdded, Collections.emptySet());
    // WHEN_dependency_errored_THEN_customer_app_restarts
    LinkedList<ExpectedStateTransition> expectedDuringDepError = new LinkedList<>(Arrays.asList(new ExpectedStateTransition(HardDependency, State.RUNNING, State.ERRORED), new ExpectedStateTransition(CustomerApp, State.RUNNING, State.STOPPING), new ExpectedStateTransition(CustomerApp, State.STARTING, State.RUNNING)));
    testRoutine(TEST_ROUTINE_SHORT_TIMEOUT, kernel, () -> kernel.locate(HardDependency).serviceErrored("mock dependency error"), "dependency errored", expectedDuringDepError, Collections.emptySet());
    // WHEN_dependency_stops_THEN_customer_app_stays_running
    LinkedList<ExpectedStateTransition> expectedDepFinish = new LinkedList<>(Arrays.asList(new ExpectedStateTransition(HardDependency, State.STOPPING, State.FINISHED)));
    Set<ExpectedStateTransition> unexpectedDepFinish = new HashSet<>(Arrays.asList(new ExpectedStateTransition(CustomerApp, State.RUNNING, State.STOPPING), new ExpectedStateTransition(CustomerApp, State.STOPPING, State.FINISHED)));
    testRoutine(TEST_ROUTINE_MEDIUM_TIMEOUT, kernel, () -> kernel.locate(HardDependency).requestStop(), "dependency stop", expectedDepFinish, unexpectedDepFinish);
    // WHEN_dependency_restarts_THEN_customer_app_restarts
    LinkedList<ExpectedStateTransition> expectedDepRestart = new LinkedList<>(Arrays.asList(new ExpectedStateTransition(HardDependency, State.STARTING, State.RUNNING), new ExpectedStateTransition(CustomerApp, State.STARTING, State.RUNNING)));
    testRoutine(TEST_ROUTINE_SHORT_TIMEOUT, kernel, () -> kernel.locate(HardDependency).requestRestart(), "dependency restart", expectedDepRestart, Collections.emptySet());
    // WHEN_dependency_reinstalled_THEN_customer_app_restarts
    LinkedList<ExpectedStateTransition> expectedDepReinstall = new LinkedList<>(Arrays.asList(new ExpectedStateTransition(HardDependency, State.NEW, State.INSTALLED), new ExpectedStateTransition(HardDependency, State.STARTING, State.RUNNING), new ExpectedStateTransition(CustomerApp, State.STARTING, State.RUNNING)));
    testRoutine(TEST_ROUTINE_SHORT_TIMEOUT, kernel, () -> kernel.locate(HardDependency).requestReinstall(), "dependency reinstall", expectedDepReinstall, Collections.emptySet());
    // WHEN_kernel_shutdown_THEN_hard_dependency_waits_for_customer_app_to_close
    LinkedList<ExpectedStateTransition> expectedDuringShutdown = new LinkedList<>(Arrays.asList(new ExpectedStateTransition(CustomerApp, State.STOPPING, State.FINISHED), new ExpectedStateTransition(HardDependency, State.STOPPING, State.FINISHED)));
    testRoutine(TEST_ROUTINE_SHORT_TIMEOUT, kernel, kernel::shutdown, "kernel shutdown", expectedDuringShutdown, Collections.emptySet());
}
Also used : HashMap(java.util.HashMap) DeploymentDocument(com.aws.greengrass.deployment.model.DeploymentDocument) URL(java.net.URL) LinkedList(java.util.LinkedList) ExpectedStateTransition(com.aws.greengrass.integrationtests.lifecyclemanager.KernelTest.ExpectedStateTransition) DeploymentConfigMerger(com.aws.greengrass.deployment.DeploymentConfigMerger) Kernel(com.aws.greengrass.lifecyclemanager.Kernel) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test)

Example 22 with Kernel

use of com.aws.greengrass.lifecyclemanager.Kernel in project aws-greengrass-nucleus by aws-greengrass.

the class UnloadableServiceIntegTest method beforeEach.

@BeforeEach
void beforeEach() {
    kernel = new Kernel();
    NoOpPathOwnershipHandler.register(kernel);
}
Also used : Kernel(com.aws.greengrass.lifecyclemanager.Kernel) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 23 with Kernel

use of com.aws.greengrass.lifecyclemanager.Kernel in project aws-greengrass-nucleus by aws-greengrass.

the class MqttClientPublishTest method before.

@BeforeEach
void before() throws IOException, InterruptedException, ExecutionException {
    kernel = new Kernel();
    ConfigPlatformResolver.initKernelWithMultiPlatformConfig(kernel, MqttClientPublishTest.class.getResource("config.yaml"));
    config = kernel.getConfig();
    deviceConfiguration = mock(DeviceConfiguration.class);
    spool = mock(Spool.class);
    builder = mock(AwsIotMqttConnectionBuilder.class);
    connection = mock(MqttClientConnection.class);
    Topics mqttNamespace = config.lookupTopics("mqtt");
    when(deviceConfiguration.getMQTTNamespace()).thenReturn(mqttNamespace);
    lenient().when(deviceConfiguration.isDeviceConfiguredToTalkToCloud()).thenReturn(true);
    lenient().when(builder.build()).thenReturn(connection);
    lenient().when(connection.connect()).thenReturn(CompletableFuture.completedFuture(false));
    lenient().when(connection.disconnect()).thenReturn(CompletableFuture.completedFuture(null));
    lenient().when(connection.publish(any(), any(), anyBoolean())).thenReturn(CompletableFuture.completedFuture(0));
    mqttClient = spy(new MqttClient(deviceConfiguration, spool, false, (c) -> builder, executorService));
    CountDownLatch awaitIpcServiceLatch = new CountDownLatch(1);
    kernel.getContext().addGlobalStateChangeListener((service, oldState, newState) -> {
        if (service.getName().equals(TEST_SERVICE_NAME) && newState.equals(State.FINISHED)) {
            awaitIpcServiceLatch.countDown();
        }
    });
    kernel.getContext().put(MqttClient.class, mqttClient);
    kernel.launch();
    assertTrue(awaitIpcServiceLatch.await(10, TimeUnit.SECONDS));
    Topics servicePrivateConfig = kernel.getConfig().findTopics(SERVICES_NAMESPACE_TOPIC, TEST_SERVICE_NAME, PRIVATE_STORE_NAMESPACE_TOPIC);
    String authToken = Coerce.toString(servicePrivateConfig.find(SERVICE_UNIQUE_ID_KEY));
    socketOptions = TestUtils.getSocketOptionsForIPC();
    clientConnection = IPCTestUtils.connectToGGCOverEventStreamIPC(socketOptions, authToken, kernel);
    greengrassCoreIPCClient = new GreengrassCoreIPCClient(clientConnection);
}
Also used : MqttClient(com.aws.greengrass.mqttclient.MqttClient) Topics(com.aws.greengrass.config.Topics) MqttClientConnection(software.amazon.awssdk.crt.mqtt.MqttClientConnection) GreengrassCoreIPCClient(software.amazon.awssdk.aws.greengrass.GreengrassCoreIPCClient) AwsIotMqttConnectionBuilder(software.amazon.awssdk.iot.AwsIotMqttConnectionBuilder) Spool(com.aws.greengrass.mqttclient.spool.Spool) CountDownLatch(java.util.concurrent.CountDownLatch) Kernel(com.aws.greengrass.lifecyclemanager.Kernel) DeviceConfiguration(com.aws.greengrass.deployment.DeviceConfiguration) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 24 with Kernel

use of com.aws.greengrass.lifecyclemanager.Kernel in project aws-greengrass-nucleus by aws-greengrass.

the class AuthorizationPolicyParser method parseAllAuthorizationPolicies.

/**
 * Given a kernel object, construct and return a map of AuthorizationPolicy objects that may exist,
 * grouped into lists of the same destination component.
 * This is used only upon kernel startup, to initialize all policies.
 * Never returns null.
 *
 * @param kernel Kernel
 * @return {@Map} of {@String} keys and {@List} of {@AuthorizationPolicy}'s as values"
 */
public Map<String, List<AuthorizationPolicy>> parseAllAuthorizationPolicies(Kernel kernel) {
    Map<String, List<AuthorizationPolicy>> primaryAuthorizationPolicyMap = new HashMap<>();
    Topics allServices = kernel.getConfig().findTopics(SERVICES_NAMESPACE_TOPIC);
    if (allServices == null) {
        logger.atWarn("load-authorization-all-services-component-config-retrieval-error").log("Unable to retrieve services config");
        return primaryAuthorizationPolicyMap;
    }
    // For each component
    for (Node service : allServices) {
        if (service == null) {
            continue;
        }
        if (!(service instanceof Topics)) {
            continue;
        }
        Topics serviceConfig = (Topics) service;
        String componentName = Kernel.findServiceForNode(serviceConfig);
        Node accessControlMapTopic = serviceConfig.findNode(CONFIGURATION_CONFIG_KEY, ACCESS_CONTROL_NAMESPACE_TOPIC);
        if (accessControlMapTopic == null) {
            continue;
        }
        // Retrieve all policies, mapped to each policy type
        Map<String, List<AuthorizationPolicy>> componentAuthorizationPolicyMap = parseAllPoliciesForComponent(accessControlMapTopic, componentName);
        // For each policy type (e.g. aws.greengrass.ipc.pubsub)
        for (Map.Entry<String, List<AuthorizationPolicy>> policyTypeList : componentAuthorizationPolicyMap.entrySet()) {
            String policyType = policyTypeList.getKey();
            List<AuthorizationPolicy> policyList = policyTypeList.getValue();
            // If multiple components have policies for the same policy type
            primaryAuthorizationPolicyMap.computeIfAbsent(policyType, k -> new ArrayList<>()).addAll(policyList);
        }
    }
    return primaryAuthorizationPolicyMap;
}
Also used : Node(com.aws.greengrass.config.Node) CONFIGURATION_CONFIG_KEY(com.aws.greengrass.componentmanager.KernelConfigResolver.CONFIGURATION_CONFIG_KEY) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) IOException(java.io.IOException) HashMap(java.util.HashMap) Coerce(com.aws.greengrass.util.Coerce) JsonMapper(com.fasterxml.jackson.databind.json.JsonMapper) SERVICES_NAMESPACE_TOPIC(com.aws.greengrass.lifecyclemanager.GreengrassService.SERVICES_NAMESPACE_TOPIC) ArrayList(java.util.ArrayList) Topic(com.aws.greengrass.config.Topic) Topics(com.aws.greengrass.config.Topics) Kernel(com.aws.greengrass.lifecyclemanager.Kernel) MapperFeature(com.fasterxml.jackson.databind.MapperFeature) List(java.util.List) Utils(com.aws.greengrass.util.Utils) ACCESS_CONTROL_NAMESPACE_TOPIC(com.aws.greengrass.lifecyclemanager.GreengrassService.ACCESS_CONTROL_NAMESPACE_TOPIC) Map(java.util.Map) LogManager(com.aws.greengrass.logging.impl.LogManager) TypeReference(com.fasterxml.jackson.core.type.TypeReference) Logger(com.aws.greengrass.logging.api.Logger) Topics(com.aws.greengrass.config.Topics) HashMap(java.util.HashMap) Node(com.aws.greengrass.config.Node) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Example 25 with Kernel

use of com.aws.greengrass.lifecyclemanager.Kernel in project aws-greengrass-cli by aws-greengrass.

the class IPCCliTest method GIVEN_kernel_running_WHEN_create_deployment_after_recipe_update_THEN_kernel_runs_latest_recipe.

@Test
@Order(7)
void GIVEN_kernel_running_WHEN_create_deployment_after_recipe_update_THEN_kernel_runs_latest_recipe(ExtensionContext context) throws Exception {
    // updated recipes
    Path recipesPath = Paths.get(this.getClass().getResource("recipes").toURI());
    // Deployment to add a component
    CreateLocalDeploymentRequest createLocalDeploymentRequest = new CreateLocalDeploymentRequest();
    createLocalDeploymentRequest.setRootComponentVersionsToAdd(Collections.singletonMap(TEST_SERVICE_NAME, "1.0.1"));
    createLocalDeploymentRequest.setRecipeDirectoryPath(recipesPath.toAbsolutePath().toString());
    CountDownLatch serviceLatch = waitForServiceToComeInState(TEST_SERVICE_NAME, State.RUNNING, kernel);
    CreateLocalDeploymentResponse addComponentDeploymentResponse = clientConnection.createLocalDeployment(createLocalDeploymentRequest, Optional.empty()).getResponse().get(DEFAULT_TIMEOUT_IN_SEC, TimeUnit.SECONDS);
    String deploymentId1 = addComponentDeploymentResponse.getDeploymentId();
    CountDownLatch deploymentLatch = waitForDeploymentToBeSuccessful(deploymentId1, kernel);
    assertTrue(serviceLatch.await(SERVICE_STATE_CHECK_TIMEOUT_SECONDS, TimeUnit.SECONDS));
    assertTrue(deploymentLatch.await(LOCAL_DEPLOYMENT_TIMEOUT_SECONDS, TimeUnit.SECONDS));
    GetComponentDetailsRequest getComponentDetailsRequest = new GetComponentDetailsRequest();
    getComponentDetailsRequest.setComponentName(TEST_SERVICE_NAME);
    ComponentDetails componentDetails = clientConnection.getComponentDetails(getComponentDetailsRequest, Optional.empty()).getResponse().get(DEFAULT_TIMEOUT_IN_SEC, TimeUnit.SECONDS).getComponentDetails();
    assertEquals("1.0.1", componentDetails.getVersion());
    // Deployment to remove a component
    createLocalDeploymentRequest = new CreateLocalDeploymentRequest();
    createLocalDeploymentRequest.setRootComponentsToRemove(Arrays.asList(TEST_SERVICE_NAME));
    serviceLatch = waitForServiceToComeInState(TEST_SERVICE_NAME, State.FINISHED, kernel);
    CreateLocalDeploymentResponse deploymentToRemoveComponentResponse = clientConnection.createLocalDeployment(createLocalDeploymentRequest, Optional.empty()).getResponse().get(DEFAULT_TIMEOUT_IN_SEC, TimeUnit.SECONDS);
    String deploymentId2 = deploymentToRemoveComponentResponse.getDeploymentId();
    deploymentLatch = waitForDeploymentToBeSuccessful(deploymentId2, kernel);
    assertTrue(serviceLatch.await(SERVICE_STATE_CHECK_TIMEOUT_SECONDS, TimeUnit.SECONDS));
    assertTrue(deploymentLatch.await(LOCAL_DEPLOYMENT_TIMEOUT_SECONDS, TimeUnit.SECONDS));
    ignoreExceptionOfType(context, ServiceLoadException.class);
    GetComponentDetailsRequest getRemovedComponent = new GetComponentDetailsRequest();
    getRemovedComponent.setComponentName(TEST_SERVICE_NAME);
    ExecutionException executionException = assertThrows(ExecutionException.class, () -> clientConnection.getComponentDetails(getRemovedComponent, Optional.empty()).getResponse().get(DEFAULT_TIMEOUT_IN_SEC, TimeUnit.SECONDS).getComponentDetails());
    assertEquals(ResourceNotFoundError.class, executionException.getCause().getClass());
    ListLocalDeploymentsRequest listLocalDeploymentsRequest = new ListLocalDeploymentsRequest();
    ListLocalDeploymentsResponse listLocalDeploymentsResponse = clientConnection.listLocalDeployments(listLocalDeploymentsRequest, Optional.empty()).getResponse().get(DEFAULT_TIMEOUT_IN_SEC, TimeUnit.SECONDS);
    List<String> localDeploymentIds = listLocalDeploymentsResponse.getLocalDeployments().stream().map(ld -> ld.getDeploymentId()).collect(Collectors.toList());
    assertThat(localDeploymentIds, containsInAnyOrder(deploymentId1, deploymentId2));
}
Also used : Path(java.nio.file.Path) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) GreengrassCoreIPCClientV2(software.amazon.awssdk.aws.greengrass.GreengrassCoreIPCClientV2) TEST_SERVICE_NAME(com.aws.greengrass.integrationtests.ipc.IPCTestUtils.TEST_SERVICE_NAME) Order(org.junit.jupiter.api.Order) DeserializationFeature(com.fasterxml.jackson.databind.DeserializationFeature) ListComponentsResponse(software.amazon.awssdk.aws.greengrass.model.ListComponentsResponse) AfterAll(org.junit.jupiter.api.AfterAll) IPCTestUtils(com.aws.greengrass.integrationtests.ipc.IPCTestUtils) LifecycleState(software.amazon.awssdk.aws.greengrass.model.LifecycleState) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) State(com.aws.greengrass.dependency.State) BaseITCase(com.aws.greengrass.integrationtests.BaseITCase) BeforeAll(org.junit.jupiter.api.BeforeAll) Map(java.util.Map) IPCTestUtils.waitForServiceToComeInState(com.aws.greengrass.integrationtests.ipc.IPCTestUtils.waitForServiceToComeInState) InvalidArgumentsError(software.amazon.awssdk.aws.greengrass.model.InvalidArgumentsError) Path(java.nio.file.Path) ComponentVersionNegotiationException(com.aws.greengrass.componentmanager.exceptions.ComponentVersionNegotiationException) GreengrassCoreIPCClient(software.amazon.awssdk.aws.greengrass.GreengrassCoreIPCClient) CLI_SERVICE(com.aws.greengrass.cli.CLIService.CLI_SERVICE) TestUtils(com.aws.greengrass.testcommons.testutilities.TestUtils) Collectors(java.util.stream.Collectors) ExceptionLogProtector.ignoreExceptionOfType(com.aws.greengrass.testcommons.testutilities.ExceptionLogProtector.ignoreExceptionOfType) SdkClientException(software.amazon.awssdk.core.exception.SdkClientException) SERVICES_NAMESPACE_TOPIC(com.aws.greengrass.lifecyclemanager.GreengrassService.SERVICES_NAMESPACE_TOPIC) Test(org.junit.jupiter.api.Test) Kernel(com.aws.greengrass.lifecyclemanager.Kernel) UnixPlatform(com.aws.greengrass.util.platforms.unix.UnixPlatform) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) GlobalStateChangeListener(com.aws.greengrass.lifecyclemanager.GlobalStateChangeListener) IPCTestUtils.getEventStreamRpcConnection(com.aws.greengrass.integrationtests.ipc.IPCTestUtils.getEventStreamRpcConnection) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) RunWithInfo(software.amazon.awssdk.aws.greengrass.model.RunWithInfo) CreateLocalDeploymentRequest(software.amazon.awssdk.aws.greengrass.model.CreateLocalDeploymentRequest) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) ListLocalDeploymentsResponse(software.amazon.awssdk.aws.greengrass.model.ListLocalDeploymentsResponse) CreateLocalDeploymentResponse(software.amazon.awssdk.aws.greengrass.model.CreateLocalDeploymentResponse) Optional(java.util.Optional) CLI_AUTH_TOKEN(com.aws.greengrass.cli.CLIService.CLI_AUTH_TOKEN) ComponentStore(com.aws.greengrass.componentmanager.ComponentStore) GetComponentDetailsRequest(software.amazon.awssdk.aws.greengrass.model.GetComponentDetailsRequest) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) ListLocalDeploymentsRequest(software.amazon.awssdk.aws.greengrass.model.ListLocalDeploymentsRequest) AUTHORIZED_POSIX_GROUPS(com.aws.greengrass.cli.CLIService.AUTHORIZED_POSIX_GROUPS) CONFIGURATION_CONFIG_KEY(com.aws.greengrass.componentmanager.KernelConfigResolver.CONFIGURATION_CONFIG_KEY) ExceptionLogProtector.ignoreExceptionUltimateCauseWithMessage(com.aws.greengrass.testcommons.testutilities.ExceptionLogProtector.ignoreExceptionUltimateCauseWithMessage) ConfigPlatformResolver(com.aws.greengrass.integrationtests.util.ConfigPlatformResolver) HashMap(java.util.HashMap) ComponentDetails(software.amazon.awssdk.aws.greengrass.model.ComponentDetails) ExtensionContext(org.junit.jupiter.api.extension.ExtensionContext) DeviceConfiguration(com.aws.greengrass.deployment.DeviceConfiguration) Platform(com.aws.greengrass.util.platforms.Platform) IPCTestUtils.getListenerForServiceRunning(com.aws.greengrass.integrationtests.ipc.IPCTestUtils.getListenerForServiceRunning) PackageDownloadException(com.aws.greengrass.componentmanager.exceptions.PackageDownloadException) GGExtension(com.aws.greengrass.testcommons.testutilities.GGExtension) AccessDeniedException(software.amazon.awssdk.eventstreamrpc.model.AccessDeniedException) ResourceNotFoundError(software.amazon.awssdk.aws.greengrass.model.ResourceNotFoundError) ConnectException(java.net.ConnectException) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) PlatformResolver(com.aws.greengrass.config.PlatformResolver) ServiceLoadException(com.aws.greengrass.lifecyclemanager.exceptions.ServiceLoadException) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) RestartComponentRequest(software.amazon.awssdk.aws.greengrass.model.RestartComponentRequest) RUN_WITH_NAMESPACE_TOPIC(com.aws.greengrass.lifecyclemanager.GreengrassService.RUN_WITH_NAMESPACE_TOPIC) ListComponentsRequest(software.amazon.awssdk.aws.greengrass.model.ListComponentsRequest) Files(java.nio.file.Files) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) UniqueRootPathExtension(com.aws.greengrass.testcommons.testutilities.UniqueRootPathExtension) ExceptionLogProtector.ignoreExceptionUltimateCauseOfType(com.aws.greengrass.testcommons.testutilities.ExceptionLogProtector.ignoreExceptionUltimateCauseOfType) EventStreamRPCConnection(software.amazon.awssdk.eventstreamrpc.EventStreamRPCConnection) IOException(java.io.IOException) File(java.io.File) ExceptionLogProtector.ignoreExceptionWithMessage(com.aws.greengrass.testcommons.testutilities.ExceptionLogProtector.ignoreExceptionWithMessage) MethodOrderer(org.junit.jupiter.api.MethodOrderer) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Topic(com.aws.greengrass.config.Topic) IPCTestUtils.waitForDeploymentToBeSuccessful(com.aws.greengrass.integrationtests.ipc.IPCTestUtils.waitForDeploymentToBeSuccessful) Paths(java.nio.file.Paths) NoOpPathOwnershipHandler(com.aws.greengrass.testcommons.testutilities.NoOpPathOwnershipHandler) Assertions(org.junit.jupiter.api.Assertions) Collections(java.util.Collections) CreateLocalDeploymentRequest(software.amazon.awssdk.aws.greengrass.model.CreateLocalDeploymentRequest) CreateLocalDeploymentResponse(software.amazon.awssdk.aws.greengrass.model.CreateLocalDeploymentResponse) ListLocalDeploymentsRequest(software.amazon.awssdk.aws.greengrass.model.ListLocalDeploymentsRequest) ListLocalDeploymentsResponse(software.amazon.awssdk.aws.greengrass.model.ListLocalDeploymentsResponse) CountDownLatch(java.util.concurrent.CountDownLatch) ExecutionException(java.util.concurrent.ExecutionException) ComponentDetails(software.amazon.awssdk.aws.greengrass.model.ComponentDetails) GetComponentDetailsRequest(software.amazon.awssdk.aws.greengrass.model.GetComponentDetailsRequest) Order(org.junit.jupiter.api.Order) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Test(org.junit.jupiter.api.Test)

Aggregations

Kernel (com.aws.greengrass.lifecyclemanager.Kernel)49 CountDownLatch (java.util.concurrent.CountDownLatch)22 BeforeEach (org.junit.jupiter.api.BeforeEach)22 Test (org.junit.jupiter.api.Test)22 HashMap (java.util.HashMap)13 IOException (java.io.IOException)12 DeploymentConfigMerger (com.aws.greengrass.deployment.DeploymentConfigMerger)11 GreengrassService (com.aws.greengrass.lifecyclemanager.GreengrassService)11 Map (java.util.Map)11 List (java.util.List)10 TimeUnit (java.util.concurrent.TimeUnit)10 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)10 State (com.aws.greengrass.dependency.State)9 DeploymentDocument (com.aws.greengrass.deployment.model.DeploymentDocument)9 BaseITCase (com.aws.greengrass.integrationtests.BaseITCase)9 ConfigPlatformResolver (com.aws.greengrass.integrationtests.util.ConfigPlatformResolver)9 TestUtils (com.aws.greengrass.testcommons.testutilities.TestUtils)9 Coerce (com.aws.greengrass.util.Coerce)9 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)9 LogManager (com.aws.greengrass.logging.impl.LogManager)8