Ejemplo n.º 1
0
  @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");
  }