@Test
  public void testGetLatestClusterConfigByStackCG() throws Exception {
    Clusters clusters = injector.getInstance(Clusters.class);
    clusters.addCluster("c1", HDP_01);

    Cluster cluster = clusters.getCluster("c1");

    initClusterEntitiesWithConfigGroups();

    Collection<ClusterConfigEntity> latestConfigs = clusterDAO.getEnabledConfigsByStack(
        cluster.getClusterId(), HDP_01);

    Assert.assertEquals(1, latestConfigs.size());
    for (ClusterConfigEntity e : latestConfigs) {
      Assert.assertEquals("version2", e.getTag());
      Assert.assertEquals("oozie-site", e.getType());
    }
  }
When the last configuration of a given configuration type to be stored into
the clusterconfig table is for a configuration group, that configuration is
not enabled. Therefore, it should be skipped when getting the enabled
configurations for a stack.
ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ServiceConfigDAOTest.java