private void makeService(String clusterName, String serviceName, RepositoryVersionEntity serviceRepo) throws Exception {
    Clusters clusters = injector.getInstance(Clusters.class);

    Cluster cluster;
    try {
      cluster = clusters.getCluster("c1");
    } catch (AmbariException e) {
      clusters.addCluster("c1", parentEntity.getStackId());
      cluster = clusters.getCluster("c1");
    }

    cluster.addService(serviceName, serviceRepo);
  }
Helper to create services that are tested with parent repo checks
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java