use of com.sequenceiq.environment.exception.ExperienceOperationFailedException in project cloudbreak by hortonworks.
the class LiftieConnectorServiceDeleteClusterTest method testWhenResponseReaderReturnsEmptyResultWhichThrowsIllegalStateExceptionThenIllegalStateExceptionShouldInvoke.
@Test
void testWhenResponseReaderReturnsEmptyResultWhichThrowsIllegalStateExceptionThenIllegalStateExceptionShouldInvoke() {
when(getMockRetryableWebTarget().delete(getMockInvocationBuilder())).thenReturn(getMockResponse());
when(getMockResponseReader().read(LIFTIE_CLUSTER_ENDPOINT_PATH, getMockResponse(), DeleteClusterResponse.class)).thenReturn(Optional.empty());
ExperienceOperationFailedException expectedException = Assertions.assertThrows(ExperienceOperationFailedException.class, () -> getUnderTest().deleteCluster(TEST_CLUSTER_ID));
assertEquals(LIFTIE_RESPONSE_RESOLVE_EXCEPTION_MSG, expectedException.getMessage());
}
use of com.sequenceiq.environment.exception.ExperienceOperationFailedException in project cloudbreak by hortonworks.
the class LiftieConnectorServiceFetchPolicyTest method testWhenCallExecutionReturnsResponseButItThrowsRuntimeExceptionThenIllegalStateExceptionShouldInvoke.
@Test
void testWhenCallExecutionReturnsResponseButItThrowsRuntimeExceptionThenIllegalStateExceptionShouldInvoke() {
when(getMockInvocationBuilderProvider().createInvocationBuilderForInternalActor(getMockWebTarget())).thenReturn(getMockInvocationBuilder());
when(getMockRetryableWebTarget().get(getMockInvocationBuilder())).thenReturn(getMockResponse());
doThrow(RuntimeException.class).when(getMockResponseReader()).read(any(), any(), any());
ExperienceOperationFailedException expectedException = assertThrows(ExperienceOperationFailedException.class, () -> getUnderTest().getPolicy(TEST_CLOUD_PLATFORM));
assertEquals(LIFTIE_RESPONSE_RESOLVE_EXCEPTION_MSG, expectedException.getMessage());
}
use of com.sequenceiq.environment.exception.ExperienceOperationFailedException in project cloudbreak by hortonworks.
the class CommonExperienceConnectorServiceTest method testDeleteWorkspaceForEnvironmentWhenCallResultIsEmptyThenIllegalStateExceptionShouldCome.
@Test
void testDeleteWorkspaceForEnvironmentWhenCallResultIsEmptyThenIllegalStateExceptionShouldCome() {
when(mockCommonExperienceWebTargetProvider.createWebTargetForClusterFetch(TEST_XP_BASE_PATH, TEST_ENV_CRN)).thenReturn(mockWebTarget);
when(mockInvocationBuilderProvider.createInvocationBuilder(mockWebTarget)).thenReturn(mockInvocationBuilder);
when(mockRetryableWebTarget.delete(mockInvocationBuilder)).thenReturn(null);
ExperienceOperationFailedException expectedException = assertThrows(ExperienceOperationFailedException.class, () -> underTest.deleteWorkspaceForEnvironment(TEST_XP_BASE_PATH, TEST_ENV_CRN, NO_FORCE_DELETE));
assertNotNull(expectedException);
assertEquals(COMMON_XP_RESPONSE_RESOLVE_ERROR_MSG, expectedException.getMessage());
}
use of com.sequenceiq.environment.exception.ExperienceOperationFailedException in project cloudbreak by hortonworks.
the class CommonExperienceConnectorServiceTest method testCollectPolicyWhenCallResultIsEmptyThenIllegalStateExceptionShouldCome.
@Test
void testCollectPolicyWhenCallResultIsEmptyThenIllegalStateExceptionShouldCome() {
when(mockCommonExperienceWebTargetProvider.createWebTargetForPolicyFetch(TEST_XP_BASE_PATH, TEST_CLOUD_PLATFORM)).thenReturn(mockWebTarget);
when(mockInvocationBuilderProvider.createInvocationBuilderForInternalActor(mockWebTarget)).thenReturn(mockInvocationBuilder);
when(mockRetryableWebTarget.get(mockInvocationBuilder)).thenReturn(null);
ExperienceOperationFailedException expectedException = assertThrows(ExperienceOperationFailedException.class, () -> underTest.collectPolicy(TEST_XP_BASE_PATH, TEST_CLOUD_PLATFORM));
assertNotNull(expectedException);
assertEquals(COMMON_XP_RESPONSE_RESOLVE_ERROR_MSG, expectedException.getMessage());
}
use of com.sequenceiq.environment.exception.ExperienceOperationFailedException in project cloudbreak by hortonworks.
the class CommonExperienceConnectorServiceTest method testCollectPolicyWhenResponseReaderUnableToResolveResponseThenIllegalStateExceptionShouldCome.
@Test
@MockitoSettings(strictness = Strictness.LENIENT)
void testCollectPolicyWhenResponseReaderUnableToResolveResponseThenIllegalStateExceptionShouldCome() {
when(mockCommonExperienceWebTargetProvider.createWebTargetForPolicyFetch(TEST_XP_BASE_PATH, TEST_CLOUD_PLATFORM)).thenReturn(mockWebTarget);
when(mockInvocationBuilderProvider.createInvocationBuilderForInternalActor(mockWebTarget)).thenReturn(mockInvocationBuilder);
when(mockRetryableWebTarget.get(mockInvocationBuilder)).thenReturn(mockResponse);
when(mockCommonExperienceResponseReader.read(TEST_URI.toString(), mockResponse, ExperiencePolicyResponse.class)).thenReturn(Optional.empty());
ExperienceOperationFailedException expectedException = assertThrows(ExperienceOperationFailedException.class, () -> underTest.collectPolicy(TEST_XP_BASE_PATH, TEST_CLOUD_PLATFORM));
assertNotNull(expectedException);
assertEquals(COMMON_XP_RESPONSE_RESOLVE_ERROR_MSG, expectedException.getMessage());
}
Aggregations