Search in sources :

Example 1 with ServiceError

use of software.amazon.awssdk.aws.greengrass.model.ServiceError in project aws-greengrass-cli by aws-greengrass.

the class CLIEventStreamAgentTest method testCreateLocalDeployment_deployments_Q_not_initialized.

@Test
void testCreateLocalDeployment_deployments_Q_not_initialized(ExtensionContext context) {
    ignoreExceptionOfType(context, ServiceError.class);
    // set it to be not initialized
    cliEventStreamAgent.setDeploymentQueue(null);
    Topics mockCliConfig = mock(Topics.class);
    CreateLocalDeploymentRequest request = new CreateLocalDeploymentRequest();
    try {
        cliEventStreamAgent.getCreateLocalDeploymentHandler(mockContext, mockCliConfig).handleRequest(request);
    } catch (ServiceError e) {
        assertEquals(DEPLOYMENTS_QUEUE_NOT_INITIALIZED, e.getMessage());
        return;
    }
    fail();
}
Also used : ServiceError(software.amazon.awssdk.aws.greengrass.model.ServiceError) CreateLocalDeploymentRequest(software.amazon.awssdk.aws.greengrass.model.CreateLocalDeploymentRequest) Topics(com.aws.greengrass.config.Topics) Test(org.junit.jupiter.api.Test)

Example 2 with ServiceError

use of software.amazon.awssdk.aws.greengrass.model.ServiceError in project aws-greengrass-nucleus by aws-greengrass.

the class LifecycleIPCEventStreamAgentTest method GIVEN_resume_component_request_WHEN_not_on_linux_THEN_throws_unsupported_operation_exception.

@Test
@DisabledOnOs(OS.LINUX)
void GIVEN_resume_component_request_WHEN_not_on_linux_THEN_throws_unsupported_operation_exception() {
    ResumeComponentRequest request = new ResumeComponentRequest();
    request.setComponentName(TEST_TARGET_COMPONENT);
    ServiceError exception = assertThrows(ServiceError.class, () -> lifecycleIPCEventStreamAgent.getResumeComponentHandler(mockContext).handleRequest(request));
    assertThat(exception.getMessage(), containsString("Pause/resume component not supported on this platform"));
}
Also used : ServiceError(software.amazon.awssdk.aws.greengrass.model.ServiceError) ResumeComponentRequest(software.amazon.awssdk.aws.greengrass.model.ResumeComponentRequest) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 3 with ServiceError

use of software.amazon.awssdk.aws.greengrass.model.ServiceError in project aws-greengrass-nucleus by aws-greengrass.

the class LifecycleIPCEventStreamAgentTest method GIVEN_pause_component_request_WHEN_not_on_linux_THEN_throws_unsupported_operation_exception.

@Test
@DisabledOnOs(OS.LINUX)
void GIVEN_pause_component_request_WHEN_not_on_linux_THEN_throws_unsupported_operation_exception() {
    PauseComponentRequest request = new PauseComponentRequest();
    request.setComponentName(TEST_TARGET_COMPONENT);
    ServiceError exception = assertThrows(ServiceError.class, () -> lifecycleIPCEventStreamAgent.getPauseComponentHandler(mockContext).handleRequest(request));
    assertThat(exception.getMessage(), containsString("Pause/resume component not supported on this platform"));
}
Also used : PauseComponentRequest(software.amazon.awssdk.aws.greengrass.model.PauseComponentRequest) ServiceError(software.amazon.awssdk.aws.greengrass.model.ServiceError) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)3 ServiceError (software.amazon.awssdk.aws.greengrass.model.ServiceError)3 DisabledOnOs (org.junit.jupiter.api.condition.DisabledOnOs)2 Topics (com.aws.greengrass.config.Topics)1 CreateLocalDeploymentRequest (software.amazon.awssdk.aws.greengrass.model.CreateLocalDeploymentRequest)1 PauseComponentRequest (software.amazon.awssdk.aws.greengrass.model.PauseComponentRequest)1 ResumeComponentRequest (software.amazon.awssdk.aws.greengrass.model.ResumeComponentRequest)1