コード例 #1
0
  @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();
  }
コード例 #2
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");
  }