@Test
  public void testRunClusterDoesNotExist() throws Exception {
    when(stormImpl.getCluster(anyString())).thenReturn(null);
    stormNodeOperationHandler.run();

    // assertions
    verify(trackerOperation)
        .addLogFailed(String.format("Cluster with name %s does not exist", "testClusterName"));
  }
  @Test
  public void testRunOperationTypeDestroy() throws ContainerHostNotFoundException {
    when(environment.getContainerHostByHostname(anyString())).thenReturn(containerHost);
    when(stormImpl.getPluginDAO()).thenReturn(pluginDAO);
    stormNodeOperationHandler4.run();

    // assertions
    //        verify( trackerOperation ).addLog( "Removing " + "testHostName" + " from cluster." );
    //        verify( trackerOperation ).addLogDone( "Cluster information is updated." );
  }
  @Before
  public void setUp() throws Exception {
    id = UUID.randomUUID().toString();
    mySet = new HashSet<>();
    mySet.add(containerHost);

    myUUID = new HashSet<>();
    myUUID.add(id);

    // mock constructor
    when(stormImpl.getCluster("testClusterName")).thenReturn(stormClusterConfiguration);
    when(stormImpl.getTracker()).thenReturn(tracker);
    when(tracker.createTrackerOperation(anyString(), anyString())).thenReturn(trackerOperation);
    when(trackerOperation.getId()).thenReturn(UUID.randomUUID());

    stormNodeOperationHandler =
        new StormNodeOperationHandler(
            stormImpl, "testClusterName", "testHostName", NodeOperationType.START);
    stormNodeOperationHandler2 =
        new StormNodeOperationHandler(
            stormImpl, "testClusterName", "testHostName", NodeOperationType.STOP);
    stormNodeOperationHandler3 =
        new StormNodeOperationHandler(
            stormImpl, "testClusterName", "testHostName", NodeOperationType.STATUS);
    stormNodeOperationHandler4 =
        new StormNodeOperationHandler(
            stormImpl, "testClusterName", "testHostName", NodeOperationType.DESTROY);

    // mock run method
    when(stormImpl.getCluster(anyString())).thenReturn(stormClusterConfiguration);
    when(stormImpl.getEnvironmentManager()).thenReturn(environmentManager);
    when(environmentManager.loadEnvironment(any(String.class))).thenReturn(environment);
    when(stormClusterConfiguration.getEnvironmentId()).thenReturn(id);
    //        when( stormImpl.getZookeeperManager() ).thenReturn( zookeeper );
    //        when( zookeeper.getCluster( anyString() ) ).thenReturn( zookeeperClusterConfig );
    when(stormClusterConfiguration.getNimbus()).thenReturn(id);
    when(containerHost.getId()).thenReturn(id);
    when(containerHost.execute(any(RequestBuilder.class))).thenReturn(commandResult);
    //        when( zookeeper.getCommand( any( CommandType.class ) ) ).thenReturn( "testCommand" );
  }
  @Test
  public void testRunNoEnvironment() throws Exception {
    when(stormImpl.getEnvironmentManager()).thenThrow(EnvironmentNotFoundException.class);

    stormNodeOperationHandler.run();
  }