コード例 #1
0
  private void populateData(int count) {
    JsonEncoder jsonEncoder = new JsonEncoder();
    try {
      for (long i = 0; i < count; i++) {
        Object value =
            ImmutableMap.of("id", Long.toString(i), "value", UUID.randomUUID().toString());

        try (Jedis jedis = embeddedRedis.getJedisPool().getResource()) {
          jedis.set(tableName + ":" + i, jsonEncoder.toString(value));
        }
      }
    } catch (Exception e) {
      throw Throwables.propagate(e);
    }
  }
コード例 #2
0
 @AfterClass
 public void stopRedis() throws Exception {
   embeddedRedis.close();
 }
コード例 #3
0
 @BeforeClass
 public void startRedis() throws Exception {
   embeddedRedis = EmbeddedRedis.createEmbeddedRedis();
   embeddedRedis.start();
 }