@Test
public void testConfigurationUpdate() throws YarnException {

  // in this test we see what happens when the configuration is changed
  // between calls. We achieve this by changing what is in the store.
  ApplicationSubmissionContext applicationSubmissionContext =
      mock(ApplicationSubmissionContext.class);
  when(applicationSubmissionContext.getQueue()).thenReturn(queue1);
  // first call runs using standard UniformRandomRouterPolicy
  SubClusterId chosen =
      routerFacade.getHomeSubcluster(applicationSubmissionContext, null);
  Assert.assertTrue(subClusterIds.contains(chosen));
  Assert.assertTrue(routerFacade.globalPolicyMap
      .get(queue1) instanceof UniformRandomRouterPolicy);
  // then the operator changes how queue1 is routed setting it to
  // PriorityRouterPolicy with weights favoring the first subcluster in
  // subClusterIds.
  store.setPolicyConfiguration(SetSubClusterPolicyConfigurationRequest
      .newInstance(getPriorityPolicy(queue1)));
  // second call is routed by new policy PriorityRouterPolicy
  chosen = routerFacade.getHomeSubcluster(applicationSubmissionContext, null);
  Assert.assertTrue(chosen.equals(subClusterIds.get(0)));
  Assert.assertTrue(routerFacade.globalPolicyMap
      .get(queue1) instanceof PriorityRouterPolicy);
}