* QueueTaskDispatcher for 7 hours and this dispatcher gets called after, we assume that we received the
* replication event. We cannot cache the events forever otherwise will end up with serious memory issue.
*/
@Test
public void shouldNotBlockItemWhenElapsedTimeIsGreaterThenCacheExpirationTime() {
PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
"refs/heads/master");
patchsetCreated.setReceivedOn(System.currentTimeMillis()
- TimeUnit.MINUTES.toMillis(ReplicationCache.DEFAULT_EXPIRATION_IN_MINUTES));
Item item = createItem(patchsetCreated, new String[] {"slaveA", "slaveB"});
assertNull("Item should not be blocked", dispatcher.canRun(item));
verify(queueMock, times(0)).maintain();
}