@Test
  public void testRunOperationTypeStatus2() throws Exception {
    when(environment.getContainerHostByHostname(anyString())).thenReturn(null);
    when(stormClusterConfiguration.isExternalZookeeper()).thenReturn(true);
    when(environment.getContainerHostByHostname(anyString())).thenReturn(containerHost);
    when(stormClusterConfiguration.getNimbus()).thenReturn(UUID.randomUUID().toString());
    when(stormClusterConfiguration.getSupervisors()).thenReturn(myUUID);

    stormNodeOperationHandler3.run();
  }
  @Test
  public void testRunOperationTypeStop() throws Exception {
    when(environment.getContainerHostByHostname(anyString())).thenReturn(null);
    when(stormClusterConfiguration.isExternalZookeeper()).thenReturn(true);
    when(environment.getContainerHostByHostname(anyString())).thenReturn(containerHost);

    stormNodeOperationHandler2.run();
  }
  @Test
  public void testRunExternalEnvironmentNoContainer() throws Exception {
    when(environment.getContainerHostByHostname(anyString())).thenReturn(null);
    when(stormClusterConfiguration.isExternalZookeeper()).thenReturn(true);

    stormNodeOperationHandler.run();

    // assertions
    verify(trackerOperation).addLogFailed(String.format("No Container with ID %s", "testHostName"));
  }
  @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" );
  }