String.format(ContainerLocalizer.TOKEN_FILE_NAME_FMT, cId)));
doReturn(new FSDataInputStream(new FakeFSDataInputStream(appTokens))
).when(spylfs).open(tokenPath);
// mock heartbeat responses from NM
LocalizationProtocol nmProxy = mock(LocalizationProtocol.class);
LocalResource rsrcA = getMockRsrc(r, LocalResourceVisibility.PRIVATE);
LocalResource rsrcB = getMockRsrc(r, LocalResourceVisibility.PRIVATE);
LocalResource rsrcC = getMockRsrc(r, LocalResourceVisibility.APPLICATION);
LocalResource rsrcD = getMockRsrc(r, LocalResourceVisibility.PRIVATE);
when(nmProxy.heartbeat(isA(LocalizerStatus.class)))
.thenReturn(new MockLocalizerHeartbeatResponse(LocalizerAction.LIVE,
Collections.singletonList(rsrcA)))
.thenReturn(new MockLocalizerHeartbeatResponse(LocalizerAction.LIVE,
Collections.singletonList(rsrcB)))
.thenReturn(new MockLocalizerHeartbeatResponse(LocalizerAction.LIVE,