@Test
public void testNodeInActiveSubCluster() throws YarnException {

  List<ResourceRequest> requests = new ArrayList<ResourceRequest>();
  requests.add(ResourceRequest
      .newInstance(Priority.UNDEFINED, "node1", Resource.newInstance(10, 1),
          1));
  requests.add(ResourceRequest
      .newInstance(Priority.UNDEFINED, "rack1", Resource.newInstance(10, 1),
          1));
  requests.add(ResourceRequest
      .newInstance(Priority.UNDEFINED, ResourceRequest.ANY,
          Resource.newInstance(10, 1), 1));
  ApplicationSubmissionContext asc = ApplicationSubmissionContext
      .newInstance(null, null, null, null, null, false, false, 0,
          Resources.none(), null, false, null, null);
  asc.setAMContainerResourceRequests(requests);
  SubClusterId chosen =
      ((FederationRouterPolicy) getPolicy()).getHomeSubcluster(asc, null);
  // If node1 is active, we should choose the sub cluster with node1
  if (getActiveSubclusters().containsKey(
      getFederationPolicyContext().getFederationSubclusterResolver()
          .getSubClusterForNode("node1").getId())) {
    Assert.assertEquals(
        getFederationPolicyContext().getFederationSubclusterResolver()
            .getSubClusterForNode("node1"), chosen);
  }
  // Regardless, we should choose an active SubCluster
  Assert.assertTrue(getActiveSubclusters().containsKey(chosen));
}