Skip to content

Commit

Permalink
Support initialization from a connection string (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 authored Dec 13, 2020
1 parent 45b8ced commit 4962a0f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public RedisTimeSeries() {
this("localhost", 6379);
}

public RedisTimeSeries(String host) {
this(new JedisPool(host));
}

/**
* Create a new RedisTimeSeries client
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,20 @@ public void testMRevRange() {
new Value[] {new Value(3000L, -33.0), new Value(2000L, 0.0)}, ranges3[1].getValues());
}

@Test
public void testStringHost() {
try (RedisTimeSeries rts = new RedisTimeSeries("localhost")) {
Assert.assertEquals(2100, rts.add("stringConnection", 2100, 2.1));
}
}

@Test
public void testStringURI() {
try (RedisTimeSeries rts = new RedisTimeSeries("redis://default:@localhost:6379/0")) {
Assert.assertEquals(2200, rts.add("uriConnection", 2200, 2.2));
}
}

@Test
public void testCloseable() {
JedisPool closeablePool = new JedisPool();
Expand Down

0 comments on commit 4962a0f

Please sign in to comment.