Package org.springframework.data.redis

Examples of org.springframework.data.redis.TestCondition


    byte[] serializedValue = redisTemplate.dump(key1);
    assertNotNull(serializedValue);
    redisTemplate.delete(key1);
    redisTemplate.restore(key1, serializedValue, 200, TimeUnit.MILLISECONDS);
    assertThat(redisTemplate.boundValueOps(key1).get(), isEqual(value1));
    waitFor(new TestCondition() {
      public boolean passes() {
        return (!redisTemplate.hasKey(key1));
      }
    }, 400);
  }
View Full Code Here


    V value1 = valueFactory.instance();
    redisTemplate.boundValueOps(key1).set(value1);
    redisTemplate.expire(key1, 10, TimeUnit.MILLISECONDS);
    assertTrue(redisTemplate.getExpire(key1, TimeUnit.MILLISECONDS) > 0l);
    // Timeout is longer because expire will be 1 sec if pExpire not supported
    waitFor(new TestCondition() {
      public boolean passes() {
        return (!redisTemplate.hasKey(key1));
      }
    }, 1500l);
  }
View Full Code Here

    template2.boundValueOps((String) key1).set((String) value1);
    template2.expire((String) key1, 10, TimeUnit.MILLISECONDS);
    Thread.sleep(15);
    // 10 millis should get rounded up to 1 sec if pExpire not supported
    assertTrue(template2.hasKey((String) key1));
    waitFor(new TestCondition() {
      public boolean passes() {
        return (!template2.hasKey((String) key1));
      }
    }, 1000l);
  }
View Full Code Here

  public void testExpireAt() {
    final K key1 = keyFactory.instance();
    V value1 = valueFactory.instance();
    redisTemplate.boundValueOps(key1).set(value1);
    redisTemplate.expireAt(key1, new Date(System.currentTimeMillis() + 5l));
    waitFor(new TestCondition() {
      public boolean passes() {
        return (!redisTemplate.hasKey(key1));
      }
    }, 5l);
  }
View Full Code Here

    factory.afterPropertiesSet();
    final StringRedisTemplate template2 = new StringRedisTemplate(factory);
    template2.boundValueOps((String) key1).set((String) value1);
    template2.expireAt((String) key1, new Date(System.currentTimeMillis() + 5l));
    // Just ensure this works as expected, pExpireAt just adds some precision over expireAt
    waitFor(new TestCondition() {
      public boolean passes() {
        return (!template2.hasKey((String) key1));
      }
    }, 5l);
  }
View Full Code Here

    });
    th.start();
    Thread.sleep(1000);
    connection.scriptKill();
    getResults();
    assertTrue(waitFor(new TestCondition() {
      public boolean passes() {
        return scriptDead.get();
      }
    }, 3000l));
  }
View Full Code Here

  public void testSetWithExpiration() {
    assumeTrue(RedisTestProfileValueSource.matches("runLongTests", "true"));
    final K key1 = keyFactory.instance();
    V value1 = valueFactory.instance();
    valueOps.set(key1, value1, 1, TimeUnit.SECONDS);
    waitFor(new TestCondition() {
      public boolean passes() {
        return (!redisTemplate.hasKey(key1));
      }
    }, 1000);
  }
View Full Code Here

    assumeTrue(RedisTestProfileValueSource.matches("runLongTests", "true"));
    final K key1 = keyFactory.instance();
    V value1 = valueFactory.instance();
    valueOps.set(key1, value1, 1, TimeUnit.MILLISECONDS);
    waitFor(new TestCondition() {
      public boolean passes() {
        return (!redisTemplate.hasKey(key1));
      }
    }, 500);
  }
View Full Code Here

      }
    });
    th.start();
    Thread.sleep(1000);
    connection.scriptKill();
    assertTrue(waitFor(new TestCondition() {
      public boolean passes() {
        return scriptDead.get();
      }
    }, 3000l));
  }
View Full Code Here

    });
    th.start();
    Thread.sleep(1000);
    connection.scriptKill();
    getResults();
    assertTrue(waitFor(new TestCondition() {
      public boolean passes() {
        return scriptDead.get();
      }
    }, 3000l));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.redis.TestCondition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.