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

    stormNodeOperationHandler3.run();
  }
  @Test
  public void testRunOperationTypeStop2() 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);

    stormNodeOperationHandler2.run();
  }
  @Test
  public void testRunErrorGettingContainer() throws Exception {
    when(environment.getContainerHostByHostname(anyString()))
        .thenThrow(ContainerHostNotFoundException.class);

    stormNodeOperationHandler.run();
  }
  @Test(expected = ClusterSetupException.class)
  public void testSetupEnvironmentNoNodes() throws Exception {
    when(solrClusterConfig.getClusterName()).thenReturn("test");
    when(solrClusterConfig.getNumberOfNodes()).thenReturn(5);
    Set<EnvironmentContainerHost> mySet = new HashSet<>();
    when(environment.getContainerHosts()).thenReturn(mySet);

    solrSetupStrategy.setup();
  }
  @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." );
  }
  @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"));
  }
  @Test
  public void testSetup() throws Exception {
    when(solrClusterConfig.getClusterName()).thenReturn("test");
    when(solrClusterConfig.getNumberOfNodes()).thenReturn(1);
    Set<EnvironmentContainerHost> mySet = new HashSet<>();
    mySet.add(containerHost);
    mySet.add(containerHost);
    when(environment.getContainerHosts()).thenReturn(mySet);
    when(containerHost.getTemplateName()).thenReturn(SolrClusterConfig.TEMPLATE_NAME);
    when(containerHost.getId()).thenReturn(UUID.randomUUID().toString());
    when(solrImpl.getPluginDAO()).thenReturn(pluginDAO);

    solrSetupStrategy.setup();

    // assertions
    verify(trackerOperation).addLog("Saving cluster information to database...");
    assertNotNull(solrImpl.getPluginDAO());
    verify(trackerOperation).addLog("Cluster information saved to database");
  }