use of com.sequenceiq.cloudbreak.domain.view.StackApiView in project cloudbreak by hortonworks.
the class StackOperationsTest method testGetForInternalCrn.
@Test
public void testGetForInternalCrn() {
when(cloudbreakUser.getUserCrn()).thenReturn("crn:altus:iam:us-west-1:altus:user:__internal__actor__");
when(stackApiViewService.retrieveStackByCrnAndType(anyString(), any(StackType.class))).thenReturn(new StackApiView());
when(stackApiViewToStackViewV4ResponseConverter.convert(any(StackApiView.class))).thenReturn(new StackViewV4Response());
doNothing().when(environmentServiceDecorator).prepareEnvironment(any(StackViewV4Response.class));
StackViewV4Response response = underTest.getForInternalCrn(NameOrCrn.ofCrn("myCrn"), STACK_TYPE);
assertNotNull(response);
verify(stackApiViewService, times(1)).retrieveStackByCrnAndType(anyString(), any(StackType.class));
verify(stackApiViewToStackViewV4ResponseConverter, times(1)).convert(any(StackApiView.class));
verify(environmentServiceDecorator, times(1)).prepareEnvironment(any(StackViewV4Response.class));
}
use of com.sequenceiq.cloudbreak.domain.view.StackApiView in project cloudbreak by hortonworks.
the class StackApiViewServiceTest method testCanChangeCredentialHappyPath.
@Test
public void testCanChangeCredentialHappyPath() {
Long stackId = 1L;
StackApiView stackApiView = new StackApiView();
stackApiView.setId(stackId);
StackStatusView stackStatusView = Mockito.mock(StackStatusView.class);
when(stackStatusView.getStatus()).thenReturn(Status.AVAILABLE);
stackApiView.setStackStatus(stackStatusView);
when(flowLogService.isOtherNonTerminationFlowRunning(stackId)).thenReturn(false);
boolean result = stackApiViewService.canChangeCredential(stackApiView);
assertTrue(result);
}
Aggregations