boolean checkIfAppExistsInStateStore(ApplicationId applicationID) {
    if (!federationEnabled) {
      return true;
    }

    try {
      // Check if app is there in state store. If app is not there then it
      // throws Exception
      this.federationFacade.getApplicationHomeSubCluster(applicationID);
    } catch (YarnException ex) {
      return false;
    }
    return true;
  }
@Test
  public void testCheckIfAppExistsInStateStore()
      throws IOException {
    ApplicationId appId = ApplicationId.newInstance(0, 0);
    Configuration conf = createConfiguration();
    conf.setBoolean(YarnConfiguration.FEDERATION_ENABLED, true);

    createAndStartAMRMProxyService(conf);

    Assert.assertFalse(getAMRMProxyService().checkIfAppExistsInStateStore(appId));

    Configuration distConf = createConfiguration();
    conf.setBoolean(YarnConfiguration.DIST_SCHEDULING_ENABLED, true);

    createAndStartAMRMProxyService(distConf);

    Assert.assertTrue(getAMRMProxyService().checkIfAppExistsInStateStore(appId));
  }