@Test
  public void testMetricsRetrieveServiceDefaults() throws Exception {
    final int LOWEST_CACHE_TIMEOUT_MINUTES = 30;

    int processorCount = Runtime.getRuntime().availableProcessors();
    final Properties ambariProperties = new Properties();
    final Configuration configuration = new Configuration(ambariProperties);

    int priority = configuration.getMetricsServiceThreadPriority();
    int cacheTimeout = configuration.getMetricsServiceCacheTimeout();
    int corePoolSize = configuration.getMetricsServiceThreadPoolCoreSize();
    int maxPoolSize = configuration.getMetricsServiceThreadPoolMaxSize();
    int workerQueueSize = configuration.getMetricsServiceWorkerQueueSize();

    // test defaults
    Assert.assertEquals(Thread.NORM_PRIORITY, priority);
    Assert.assertEquals(LOWEST_CACHE_TIMEOUT_MINUTES, cacheTimeout);
    Assert.assertEquals(Configuration.PROCESSOR_BASED_THREADPOOL_CORE_SIZE_DEFAULT, corePoolSize);
    Assert.assertEquals(Configuration.PROCESSOR_BASED_THREADPOOL_MAX_SIZE_DEFAULT, maxPoolSize);
    Assert.assertEquals(maxPoolSize * 10, workerQueueSize);

    // now let's test to make sure these all make sense
    Assert.assertTrue(priority <= Thread.NORM_PRIORITY);
    Assert.assertTrue(priority > Thread.MIN_PRIORITY);

    Assert.assertTrue(cacheTimeout >= LOWEST_CACHE_TIMEOUT_MINUTES);
    Assert.assertTrue(corePoolSize > 2 && corePoolSize <= 128);
    Assert.assertTrue(maxPoolSize > 2 && maxPoolSize <= processorCount * 4);
    Assert.assertTrue(workerQueueSize >= processorCount * 10);
  }
Tests the default values for the {@link MetricsRetrievalService}.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java