@Test public void buildsESChecker() throws Exception { configuration.setCheckerType(DiskSpaceConfiguration.ELASTICSEARCH_CHECKER); configuration.getConfiguration().put(ElasticsearchDiskSpaceChecker.CACHE_MS_CONFIG_OPTION, 5000); DiskSpaceChecker checker = builder.build(); assertThat(checker).isNotNull(); assertThat(checker).isInstanceOf(ElasticsearchDiskSpaceChecker.class); verify(healthChecks).register(isA(String.class), isA(ElasticsearchClientHealthCheck.class)); }
@SuppressWarnings("unchecked") public DiskSpaceChecker build() throws ClassNotFoundException, DiskSpaceCheckerException { final DiskSpaceChecker checker; switch (configuration.getCheckerType()) { case DiskSpaceConfiguration.ELASTICSEARCH_CHECKER: checker = buildElasticsearchChecker(environment); break; case DiskSpaceConfiguration.SOLR_LOCAL_CHECKER: checker = new SolrDiskSpaceChecker(); break; case DiskSpaceConfiguration.CLUSTER_CHECKER: checker = buildClusterChecker(environment, (List<String>) configuration.getConfiguration().get(ClusterDiskSpaceChecker.CLUSTER_SERVERS_CONFIG_OPTION)); break; default: checker = buildCustomChecker(configuration.getCheckerType()); } if (checker != null) { checker.configure(configuration.getConfiguration()); checker.setThreshold(DiskSpaceThreshold.parse(configuration.getThreshold())); if (checker.requiresHttpClient()) { checker.setHttpClient(client); } } return checker; }
DiskSpaceCheckerBuilder { @SuppressWarnings("unchecked") public DiskSpaceChecker build() throws ClassNotFoundException, DiskSpaceCheckerException { final DiskSpaceChecker checker; switch (configuration.getCheckerType()) { case DiskSpaceConfiguration.ELASTICSEARCH_CHECKER: checker = buildElasticsearchChecker(environment); break; case DiskSpaceConfiguration.SOLR_LOCAL_CHECKER: checker = new SolrDiskSpaceChecker(); break; case DiskSpaceConfiguration.CLUSTER_CHECKER: checker = buildClusterChecker(environment, (List<String>) configuration.getConfiguration().get(ClusterDiskSpaceChecker.CLUSTER_SERVERS_CONFIG_OPTION)); break; default: checker = buildCustomChecker(configuration.getCheckerType()); } if (checker != null) { checker.configure(configuration.getConfiguration()); checker.setThreshold(DiskSpaceThreshold.parse(configuration.getThreshold())); if (checker.requiresHttpClient()) { checker.setHttpClient(client); } } return checker; } }
DiskSpaceCheckerBuilder { @SuppressWarnings("unchecked") public DiskSpaceChecker build() throws ClassNotFoundException, DiskSpaceCheckerException { final DiskSpaceChecker checker; switch (configuration.getCheckerType()) { case DiskSpaceConfiguration.ELASTICSEARCH_CHECKER: checker = buildElasticsearchChecker(environment); break; case DiskSpaceConfiguration.SOLR_LOCAL_CHECKER: checker = new SolrDiskSpaceChecker(); break; case DiskSpaceConfiguration.CLUSTER_CHECKER: checker = buildClusterChecker(environment, (List<String>) configuration.getConfiguration().get(ClusterDiskSpaceChecker.CLUSTER_SERVERS_CONFIG_OPTION)); break; default: checker = buildCustomChecker(configuration.getCheckerType()); } if (checker != null) { checker.configure(configuration.getConfiguration()); checker.setThreshold(DiskSpaceThreshold.parse(configuration.getThreshold())); if (checker.requiresHttpClient()) { checker.setHttpClient(client); } } return checker; } DiskSpaceCheckerBuilder(Environment environment, Client client, DiskSpaceConfiguration configuration); }
DiskSpaceCheckerBuilder { @SuppressWarnings("unchecked") public DiskSpaceChecker build() throws ClassNotFoundException, DiskSpaceCheckerException { final DiskSpaceChecker checker; switch (configuration.getCheckerType()) { case DiskSpaceConfiguration.ELASTICSEARCH_CHECKER: checker = buildElasticsearchChecker(environment); break; case DiskSpaceConfiguration.SOLR_LOCAL_CHECKER: checker = new SolrDiskSpaceChecker(); break; case DiskSpaceConfiguration.CLUSTER_CHECKER: checker = buildClusterChecker(environment, (List<String>) configuration.getConfiguration().get(ClusterDiskSpaceChecker.CLUSTER_SERVERS_CONFIG_OPTION)); break; default: checker = buildCustomChecker(configuration.getCheckerType()); } if (checker != null) { checker.configure(configuration.getConfiguration()); checker.setThreshold(DiskSpaceThreshold.parse(configuration.getThreshold())); if (checker.requiresHttpClient()) { checker.setHttpClient(client); } } return checker; } DiskSpaceCheckerBuilder(Environment environment, Client client, DiskSpaceConfiguration configuration); @SuppressWarnings("unchecked") DiskSpaceChecker build(); }
DiskSpaceCheckerBuilder { @SuppressWarnings("unchecked") public DiskSpaceChecker build() throws ClassNotFoundException, DiskSpaceCheckerException { final DiskSpaceChecker checker; switch (configuration.getCheckerType()) { case DiskSpaceConfiguration.ELASTICSEARCH_CHECKER: checker = buildElasticsearchChecker(environment); break; case DiskSpaceConfiguration.SOLR_LOCAL_CHECKER: checker = new SolrDiskSpaceChecker(); break; case DiskSpaceConfiguration.CLUSTER_CHECKER: checker = buildClusterChecker(environment, (List<String>) configuration.getConfiguration().get(ClusterDiskSpaceChecker.CLUSTER_SERVERS_CONFIG_OPTION)); break; default: checker = buildCustomChecker(configuration.getCheckerType()); } if (checker != null) { checker.configure(configuration.getConfiguration()); checker.setThreshold(DiskSpaceThreshold.parse(configuration.getThreshold())); if (checker.requiresHttpClient()) { checker.setHttpClient(client); } } return checker; } DiskSpaceCheckerBuilder(Environment environment, Client client, DiskSpaceConfiguration configuration); @SuppressWarnings("unchecked") DiskSpaceChecker build();  }