@Before public void setUp() throws CloudbreakSecuritySetupException { stack = TestUtil.stack(); cluster = TestUtil.cluster(TestUtil.blueprint(), stack, 1L); stack.setCluster(cluster); clusterRequest = new ClusterRequest(); clusterResponse = new ClusterResponse(); when(stackService.get(anyLong())).thenReturn(stack); when(stackService.getById(anyLong())).thenReturn(stack); when(stackService.findLazy(anyLong())).thenReturn(stack); when(clusterRepository.save(any(Cluster.class))).thenReturn(cluster); given(tlsSecurityService.buildTLSClientConfig(anyLong(), anyString())) .willReturn(new TLSClientConfig("", "/tmp")); }
@Test(expected = BadRequestException.class) public void testStopWhenAwsHasEphemeralVolume() { cluster = TestUtil.cluster( TestUtil.blueprint(), TestUtil.stack(Status.AVAILABLE, TestUtil.awsCredential()), 1L); stack = TestUtil.setEphemeral(cluster.getStack()); cluster.setStatus(Status.AVAILABLE); cluster.setStack(stack); stack.setCluster(cluster); when(stackService.get(anyLong())).thenReturn(stack); when(stackService.getById(anyLong())).thenReturn(stack); underTest.updateStatus(1L, StatusRequest.STOPPED); }