Package com.codahale.metrics.health

Examples of com.codahale.metrics.health.HealthCheckRegistry


                .isEqualTo("application/json");
    }

    @Test
    public void constructorWithRegistryAsArgumentIsUsedInPreferenceOverServletConfig() throws Exception {
        final HealthCheckRegistry healthCheckRegistry = mock(HealthCheckRegistry.class);
        final ServletContext servletContext = mock(ServletContext.class);
        final ServletConfig servletConfig = mock(ServletConfig.class);
        when(servletConfig.getServletContext()).thenReturn(servletContext);
        final HealthCheckServlet healthCheckServlet = new HealthCheckServlet(healthCheckRegistry);
View Full Code Here


        verify(servletContext, never()).getAttribute(eq(HealthCheckServlet.HEALTH_CHECK_REGISTRY));
    }

    @Test
    public void constructorWithRegistryAsArgumentUsesServletConfigWhenNull() throws Exception {
        final HealthCheckRegistry healthCheckRegistry = mock(HealthCheckRegistry.class);
        final ServletContext servletContext = mock(ServletContext.class);
        final ServletConfig servletConfig = mock(ServletConfig.class);
        when(servletConfig.getServletContext()).thenReturn(servletContext);
        when(servletContext.getAttribute(eq(HealthCheckServlet.HEALTH_CHECK_REGISTRY)))
             .thenReturn(healthCheckRegistry);
View Full Code Here

        server.addConnector(connector);

        final ServletContextHandler context = new ServletContextHandler();
        context.setContextPath("/initial");
        context.setAttribute(MetricsServlet.METRICS_REGISTRY, REGISTRY);
        context.setAttribute(HealthCheckServlet.HEALTH_CHECK_REGISTRY, new HealthCheckRegistry());

        final ServletHolder holder = new ServletHolder(new AdminServlet());
        context.addServlet(holder, "/dingo/*");

        final InstrumentedHandler handler = new InstrumentedHandler(REGISTRY);
View Full Code Here

                       MetricRegistry metricRegistry,
                       ClassLoader classLoader) {
        this.name = name;
        this.objectMapper = objectMapper;
        this.metricRegistry = metricRegistry;
        this.healthCheckRegistry = new HealthCheckRegistry();
        this.validator = validator;

        this.servletContext = new MutableServletContextHandler();
        servletContext.setClassLoader(classLoader);
        this.servletEnvironment = new ServletEnvironment(servletContext);
View Full Code Here

                       MetricRegistry metricRegistry,
                       ClassLoader classLoader) {
        this.name = name;
        this.objectMapper = objectMapper;
        this.metricRegistry = metricRegistry;
        this.healthCheckRegistry = new HealthCheckRegistry();
        this.validator = validator;

        this.servletContext = new MutableServletContextHandler();
        servletContext.setClassLoader(classLoader);
        this.servletEnvironment = new ServletEnvironment(servletContext);
View Full Code Here

    };
   
    MetricRegistry metricRegistry = new MetricRegistry();
    metricRegistry.register("myCounter", new Counter());
   
    HealthCheckRegistry healthChecks = new HealthCheckRegistry();
    healthChecks.register("foo", new HealthCheck() {     
      @Override
      protected Result check() throws Exception {
        return Result.healthy("flawless");
      }
    });
View Full Code Here

  @BeforeClass
  public static void beforeClass() {
    metricRegistry = new MetricRegistry();
    metricRegistry.addListener(new LoggingMetricRegistryListener());

    healthCheckRegistry = new HealthCheckRegistry();

    applicationContext = new AnnotationConfigApplicationContext(MetricsConfig.class);
    testBean = applicationContext.getBean(TestBean.class);
  }
View Full Code Here

    };
   
    MetricRegistry metricRegistry = new MetricRegistry();
    metricRegistry.register("myCounter", new Counter());
   
    HealthCheckRegistry healthChecks = new HealthCheckRegistry();
    healthChecks.register("foo", new HealthCheck() {     
      @Override
      protected Result check() throws Exception {
        return Result.healthy("flawless");
      }
    });
View Full Code Here

  protected HealthCheckRegistry getHealthCheckRegistry() {
    if (healthCheckRegistry == null) {
      synchronized (lock) {
        if (healthCheckRegistry == null) {
          healthCheckRegistry = new HealthCheckRegistry();
        }
      }
    }
    return healthCheckRegistry;
  }
View Full Code Here

  @Override
  public HealthCheckRegistry getHealthCheckRegistry() {
    final List<HealthCheckRegistry> candidates = new ArrayList<HealthCheckRegistry>();
    for (MetricsConfigurer configurer : this.configurers) {
      final HealthCheckRegistry healthCheckRegistry = configurer.getHealthCheckRegistry();
      if (healthCheckRegistry != null) {
        candidates.add(healthCheckRegistry);
      }
    }
    HealthCheckRegistry instance = selectSingleInstance(candidates, HealthCheckRegistry.class);
    if (instance == null) {
      instance = new HealthCheckRegistry();
    }
    return instance;
  }
View Full Code Here

TOP

Related Classes of com.codahale.metrics.health.HealthCheckRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.