@Test(expected = CloudbreakOrchestratorFailedException.class) public void ambariServerStartInClusterWhenNullPointerOccurredAndOrchestratorFailedComes() throws Exception { when(ambariServerBootstrap.call()).thenReturn(true); doReturn(ambariServerBootstrap) .when(underTestSpy) .ambariServerBootstrap( any(GatewayConfig.class), anyString(), any(Node.class), anyString(), any(LogVolumePath.class)); when(ambariServerDatabaseBootstrap.call()).thenThrow(new NullPointerException("null")); doReturn(ambariServerDatabaseBootstrap) .when(underTestSpy) .ambariServerDatabaseBootstrap( any(GatewayConfig.class), anyString(), any(Node.class), any(LogVolumePath.class)); underTestSpy.startAmbariServer( containerOrchestratorCluster(gatewayConfig(), generateNodes(FIX_NODE_COUNT)), new ContainerConfig("serverdb", "0.0.1"), new ContainerConfig("serverdb", "0.0.1"), "azure", generateLogVolume(), false, exitCriteriaModel()); }
@Test public void ambariServerStartInClusterWhenEverythingWorksFine() throws Exception { when(ambariServerBootstrap.call()).thenReturn(true); doReturn(ambariServerBootstrap) .when(underTestSpy) .ambariServerBootstrap( any(GatewayConfig.class), anyString(), any(Node.class), anyString(), any(LogVolumePath.class)); when(ambariServerDatabaseBootstrap.call()).thenReturn(true); doReturn(ambariServerDatabaseBootstrap) .when(underTestSpy) .ambariServerDatabaseBootstrap( any(GatewayConfig.class), anyString(), any(Node.class), any(LogVolumePath.class)); underTestSpy.startAmbariServer( containerOrchestratorCluster(gatewayConfig(), generateNodes(FIX_NODE_COUNT)), new ContainerConfig("serverdb", "0.0.1"), new ContainerConfig("serverdb", "0.0.1"), "azure", generateLogVolume(), false, exitCriteriaModel()); }