@Test public void shouldNotMatchPoolOperationWhenPoolStatusDoesNotMatch() { givenFilterWith(null, null, "RESTART", false, false, false, null, null, null, null); givenPoolOperationWith( System.currentTimeMillis(), System.currentTimeMillis(), "DOWN", "WAITING"); assertFalse(filter.matches("resilient_pool-0", poolOperation)); }
@Test public void shouldMatchPoolOperationWhenPoolStateMatches() { givenFilterWith(null, "WAITING,RUNNING", null, false, false, false, null, null, null, null); givenPoolOperationWith( System.currentTimeMillis(), System.currentTimeMillis(), "DOWN", "WAITING"); assertTrue(filter.matches("resilient_pool-0", poolOperation)); }
@Test public void shouldMatchPoolOperationWhenAfterUpdateMatches() { givenFilterWith( null, null, null, false, false, false, System.currentTimeMillis(), null, null, null); givenPoolOperationWith( System.currentTimeMillis(), System.currentTimeMillis() - TimeUnit.HOURS.toMillis(1), "DOWN", "WAITING"); assertTrue(filter.matches("resilient_pool-0", poolOperation)); }
@Test public void shouldNotMatchPoolOperationWhenBeforeUpdateDoesNotMatch() { givenFilterWith( null, null, "RESTART", false, false, false, System.currentTimeMillis() - TimeUnit.HOURS.toMillis(2), null, null, null); givenPoolOperationWith( System.currentTimeMillis(), System.currentTimeMillis() - TimeUnit.HOURS.toMillis(1), "DOWN", "WAITING"); assertFalse(filter.matches("resilient_pool-0", poolOperation)); }
@Test public void shouldMatchFileOperationWhenSourceMatchesSourcePool() throws CacheException { givenFilterWith("resilient_pool-0", null, null, false, true, false, null, null, null, null); givenFileOperationWith(null, "resilient_pool-0", null); assertTrue(filter.matches(fileOperation, poolInfoMap)); }
@Test public void shouldNotMatchFileOperationWhenTargetDoesNotMatchTargetPool() throws CacheException { givenFilterWith("resilient_pool-0", null, null, false, false, true, null, null, null, null); givenFileOperationWith(null, null, null); assertFalse(filter.matches(fileOperation, poolInfoMap)); }