@Test
public void testFindMaxVersions() throws Exception {

  createServiceConfig("HDFS", "admin", 1L, 1L, 1111L, null);
  createServiceConfig("HDFS", "admin", 2L, 2L, 2222L, null);
  createServiceConfig("YARN", "admin", 1L, 3L, 3333L, null);
  long hdfsVersion = serviceConfigDAO.findNextServiceConfigVersion(
      clusterDAO.findByName("c1").getClusterId(), "HDFS");
  long yarnVersion = serviceConfigDAO.findNextServiceConfigVersion(
      clusterDAO.findByName("c1").getClusterId(), "YARN");
  Assert.assertEquals(3, hdfsVersion);
  Assert.assertEquals(2, yarnVersion);
}