예제 #1
0
 @Before
 public void setUp() throws Exception {
   solrSetupStrategy =
       new SolrSetupStrategy(solrImpl, trackerOperation, solrClusterConfig, environment);
   when(solrImpl.getEnvironmentManager()).thenReturn(environmentManager);
   when(environmentManager.loadEnvironment(any(String.class))).thenReturn(environment);
 }
예제 #2
0
  @Test(expected = ClusterSetupException.class)
  public void testSetupClusterAlreadyExist() throws Exception {
    when(solrClusterConfig.getClusterName()).thenReturn("test");
    when(solrClusterConfig.getNumberOfNodes()).thenReturn(5);
    when(solrImpl.getCluster(anyString())).thenReturn(solrClusterConfig);

    solrSetupStrategy.setup();
  }
예제 #3
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");
  }