AMRMProxyService extends CompositeService implements
    ApplicationMasterProtocol { boolean checkIfAppExistsInStateStore(ApplicationId applicationID) { if (!federationEnabled) { return true; } try { this.federationFacade.getApplicationHomeSubCluster(applicationID); } catch (YarnException ex) { return false; } return true; } AMRMProxyService(Context nmContext, AsyncDispatcher dispatcher); void recover(); @Override RegisterApplicationMasterResponse registerApplicationMaster(
      RegisterApplicationMasterRequest request); @Override FinishApplicationMasterResponse finishApplicationMaster(
      FinishApplicationMasterRequest request); @Override AllocateResponse allocate(AllocateRequest request); void processApplicationStartRequest(StartContainerRequest request); @Private InetSocketAddress getBindAddress(); @Private AMRMProxyTokenSecretManager getSecretManager();  }
@Test public void testCheckIfAppExistsInStateStore() throws IOException, YarnException { ApplicationId appId = ApplicationId.newInstance(0, 0); Configuration conf = createConfiguration(); conf.setBoolean(YarnConfiguration.FEDERATION_ENABLED, true); createAndStartAMRMProxyService(conf); Assert.assertEquals(false, getAMRMProxyService().checkIfAppExistsInStateStore(appId)); Configuration distConf = createConfiguration(); conf.setBoolean(YarnConfiguration.DIST_SCHEDULING_ENABLED, true); createAndStartAMRMProxyService(distConf); Assert.assertEquals(true, getAMRMProxyService().checkIfAppExistsInStateStore(appId)); }