All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.foryouandyourcustomers.health.test.HealthTest Maven / Gradle / Ivy

Go to download

The main goal of this module is to enable the creation of health checks as a tool for testing the application in run time.

The newest version!
package com.foryouandyourcustomers.health.test;

import static com.foryouandyourcustomers.health.HealthCheckType.LARGE;
import static com.foryouandyourcustomers.health.HealthCheckType.MEDIUM;
import static com.foryouandyourcustomers.health.HealthCheckType.ONCE;
import static com.foryouandyourcustomers.health.HealthCheckType.SHORT;

import java.util.HashMap;
import java.util.Map;
import com.foryouandyourcustomers.health.HealthCheck;
import com.google.common.collect.Maps;
import org.springframework.stereotype.Component;

@Component
public class HealthTest {

  private Map ranTest = Maps.newHashMap();

  public Map getRanTest() {
    return ranTest;
  }

  @HealthCheck(type = ONCE)
  public void onceCheck() {
    this.ranTest.put(ONCE.toString(), true);
  }

  @HealthCheck(type = SHORT)
  public void shortCheck() {
    this.ranTest.put(SHORT.toString(), true);
  }

  @HealthCheck(type = MEDIUM)
  public void mediumCheck() {
    this.ranTest.put(MEDIUM.toString(), true);
  }

  @HealthCheck(type = LARGE)
  public void largeCheck() {
    this.ranTest.put(LARGE.toString(), true);
  }

  @HealthCheck
  public void defaultCheck() {
    this.ranTest.put("default", true);
  }

  @HealthCheck
  public Map exampleWithReturn() {
    HashMap description = new HashMap();
    description.put(
        "Adding any serializable object here", "will produce extra description in the health json");
    this.ranTest.put("exampleWithReturn", true);
    return description;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy