test_class.declarator: elasticsearch = mock(ElasticsearchClient.class)
test_class.modifier: private
test_class.original_string: private ElasticsearchClient elasticsearch = mock(ElasticsearchClient.class);
test_class.type: ElasticsearchClient
test_class.var_name: elasticsearch
test_class.declarator: threshold = mock(DiskSpaceThreshold.class)
test_class.modifier: private
test_class.original_string: private DiskSpaceThreshold threshold = mock(DiskSpaceThreshold.class);
test_class.type: DiskSpaceThreshold
test_class.var_name: threshold
test_class.file: harahachibu/src/test/java/uk/co/flax/harahachibu/services/impl/ElasticsearchDiskSpaceCheckerTest.java
test_class.identifier: ElasticsearchDiskSpaceCheckerTest
test_case.body: @Test(expected = uk.co.flax.harahachibu.services.DiskSpaceCheckerException.class)
  	public void throwsExceptionWhenESFails() throws Exception {
  		when(elasticsearch.getClusterStats()).thenThrow(new DiskSpaceCheckerException("error"));
  		ElasticsearchDiskSpaceChecker checker = new ElasticsearchDiskSpaceChecker(elasticsearch);
  
  		checker.isSpaceAvailable();
  
  		verify(elasticsearch).getClusterStats();
  	}
test_case.class_method_signature: ElasticsearchDiskSpaceCheckerTest.throwsExceptionWhenESFails()
test_case.full_signature: @Test(expected = uk.co.flax.harahachibu.services.DiskSpaceCheckerException.class) public void throwsExceptionWhenESFails()
test_case.identifier: throwsExceptionWhenESFails
test_case.invocations: thenThrow when getClusterStats isSpaceAvailable getClusterStats verify
test_case.modifiers: @Test(expected = uk.co.flax.harahachibu.services.DiskSpaceCheckerException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void throwsExceptionWhenESFails()
focal_class.declarator: BASE_URL_CONFIG_OPTION = "baseURL"
focal_class.modifier: public static final
focal_class.original_string: public static final String BASE_URL_CONFIG_OPTION = "baseURL";
focal_class.type: String
focal_class.var_name: BASE_URL_CONFIG_OPTION
focal_class.declarator: CACHE_MS_CONFIG_OPTION = "cacheMs"
focal_class.modifier: public static final
focal_class.original_string: public static final String CACHE_MS_CONFIG_OPTION = "cacheMs";
focal_class.type: String
focal_class.var_name: CACHE_MS_CONFIG_OPTION
focal_class.declarator: LOGGER = LoggerFactory.getLogger(ElasticsearchDiskSpaceChecker.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(ElasticsearchDiskSpaceChecker.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: elasticsearch
focal_class.modifier: private final
focal_class.original_string: private final ElasticsearchClient elasticsearch;
focal_class.type: ElasticsearchClient
focal_class.var_name: elasticsearch
focal_class.declarator: threshold
focal_class.modifier: private
focal_class.original_string: private DiskSpaceThreshold threshold;
focal_class.type: DiskSpaceThreshold
focal_class.var_name: threshold
focal_class.file: harahachibu/src/main/java/uk/co/flax/harahachibu/services/impl/ElasticsearchDiskSpaceChecker.java
focal_class.identifier: ElasticsearchDiskSpaceChecker
focal_class.interfaces: implements DiskSpaceChecker
focal_class.class_method_signature: ElasticsearchDiskSpaceChecker.ElasticsearchDiskSpaceChecker(ElasticsearchClient client)
focal_class.full_signature: public  ElasticsearchDiskSpaceChecker(ElasticsearchClient client)
focal_class.identifier: ElasticsearchDiskSpaceChecker
focal_class.modifiers: public
focal_class.parameters: (ElasticsearchClient client)
focal_class.signature:  ElasticsearchDiskSpaceChecker(ElasticsearchClient client)
focal_class.class_method_signature: ElasticsearchDiskSpaceChecker.isSpaceAvailable()
focal_class.full_signature: @Override public boolean isSpaceAvailable()
focal_class.identifier: isSpaceAvailable
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isSpaceAvailable()
focal_class.class_method_signature: ElasticsearchDiskSpaceChecker.configure(Map<String, Object> configuration)
focal_class.full_signature: @Override public void configure(Map<String, Object> configuration)
focal_class.identifier: configure
focal_class.modifiers: @Override public
focal_class.parameters: (Map<String, Object> configuration)
focal_class.return: void
focal_class.signature: void configure(Map<String, Object> configuration)
focal_class.class_method_signature: ElasticsearchDiskSpaceChecker.requiresHttpClient()
focal_class.full_signature: @Override public boolean requiresHttpClient()
focal_class.identifier: requiresHttpClient
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean requiresHttpClient()
focal_class.class_method_signature: ElasticsearchDiskSpaceChecker.setHttpClient(Client httpClient)
focal_class.full_signature: @Override public void setHttpClient(Client httpClient)
focal_class.identifier: setHttpClient
focal_class.modifiers: @Override public
focal_class.parameters: (Client httpClient)
focal_class.return: void
focal_class.signature: void setHttpClient(Client httpClient)
focal_class.class_method_signature: ElasticsearchDiskSpaceChecker.setThreshold(DiskSpaceThreshold threshold)
focal_class.full_signature: @Override public void setThreshold(DiskSpaceThreshold threshold)
focal_class.identifier: setThreshold
focal_class.modifiers: @Override public
focal_class.parameters: (DiskSpaceThreshold threshold)
focal_class.return: void
focal_class.signature: void setThreshold(DiskSpaceThreshold threshold)
focal_method.body: @Override
  	public boolean isSpaceAvailable() throws DiskSpaceCheckerException {
  		final ElasticsearchClusterStats stats = elasticsearch.getClusterStats();
  
  		long free = stats.getFilesystemAvailableBytes();
  		long max = stats.getFilesystemTotalBytes();
  
  		if (max == 0) {
  			LOGGER.warn("ES Cluster Stats reports 0 total bytes - possible issue with ES cluster");
  		} else if (free == 0) {
  			LOGGER.warn("ES Cluster Stats reports 0 free bytes");
  		}
  
  		boolean ret = threshold.withinThreshold(free, max);
  		LOGGER.debug("ES threshold check returned {}", ret);
  
  		return ret;
  	}
focal_method.class_method_signature: ElasticsearchDiskSpaceChecker.isSpaceAvailable()
focal_method.full_signature: @Override public boolean isSpaceAvailable()
focal_method.identifier: isSpaceAvailable
focal_method.invocations: getClusterStats getFilesystemAvailableBytes getFilesystemTotalBytes warn warn withinThreshold debug
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: boolean
focal_method.signature: boolean isSpaceAvailable()