|
|
@ -55,7 +55,7 @@ public class RedisMultiMetricRepositoryTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Parameters
|
|
|
|
@Parameters
|
|
|
|
public static List<Object[]> parameters() {
|
|
|
|
public static List<Object[]> parameters() {
|
|
|
|
return Arrays.<Object[]> asList(new Object[] { null }, new Object[] { "test" });
|
|
|
|
return Arrays.<Object[]>asList(new Object[] { null }, new Object[] { "test" });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Before
|
|
|
|
@Before
|
|
|
@ -85,26 +85,26 @@ public class RedisMultiMetricRepositoryTests {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void setAndGet() {
|
|
|
|
public void setAndGet() {
|
|
|
|
this.repository.set("foo",
|
|
|
|
this.repository.set("foo",
|
|
|
|
Arrays.<Metric<?>> asList(new Metric<Number>("foo.bar", 12.3)));
|
|
|
|
Arrays.<Metric<?>>asList(new Metric<Number>("foo.bar", 12.3)));
|
|
|
|
this.repository.set("foo",
|
|
|
|
this.repository.set("foo",
|
|
|
|
Arrays.<Metric<?>> asList(new Metric<Number>("foo.bar", 15.3)));
|
|
|
|
Arrays.<Metric<?>>asList(new Metric<Number>("foo.bar", 15.3)));
|
|
|
|
assertEquals(15.3, Iterables.collection(this.repository.findAll("foo"))
|
|
|
|
assertEquals(15.3, Iterables.collection(this.repository.findAll("foo"))
|
|
|
|
.iterator().next().getValue());
|
|
|
|
.iterator().next().getValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void setAndGetMultiple() {
|
|
|
|
public void setAndGetMultiple() {
|
|
|
|
this.repository.set("foo", Arrays.<Metric<?>> asList(new Metric<Number>(
|
|
|
|
this.repository.set("foo", Arrays.<Metric<?>>asList(new Metric<Number>("foo.val",
|
|
|
|
"foo.val", 12.3), new Metric<Number>("foo.bar", 11.3)));
|
|
|
|
12.3), new Metric<Number>("foo.bar", 11.3)));
|
|
|
|
assertEquals(2, Iterables.collection(this.repository.findAll("foo")).size());
|
|
|
|
assertEquals(2, Iterables.collection(this.repository.findAll("foo")).size());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void groups() {
|
|
|
|
public void groups() {
|
|
|
|
this.repository.set("foo", Arrays.<Metric<?>> asList(new Metric<Number>(
|
|
|
|
this.repository.set("foo", Arrays.<Metric<?>>asList(new Metric<Number>("foo.val",
|
|
|
|
"foo.val", 12.3), new Metric<Number>("foo.bar", 11.3)));
|
|
|
|
12.3), new Metric<Number>("foo.bar", 11.3)));
|
|
|
|
this.repository.set("bar", Arrays.<Metric<?>> asList(new Metric<Number>(
|
|
|
|
this.repository.set("bar", Arrays.<Metric<?>>asList(new Metric<Number>("bar.val",
|
|
|
|
"bar.val", 12.3), new Metric<Number>("bar.foo", 11.3)));
|
|
|
|
12.3), new Metric<Number>("bar.foo", 11.3)));
|
|
|
|
Collection<String> groups = Iterables.collection(this.repository.groups());
|
|
|
|
Collection<String> groups = Iterables.collection(this.repository.groups());
|
|
|
|
assertEquals(2, groups.size());
|
|
|
|
assertEquals(2, groups.size());
|
|
|
|
assertTrue("Wrong groups: " + groups, groups.contains("foo"));
|
|
|
|
assertTrue("Wrong groups: " + groups, groups.contains("foo"));
|
|
|
@ -112,10 +112,10 @@ public class RedisMultiMetricRepositoryTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void count() {
|
|
|
|
public void count() {
|
|
|
|
this.repository.set("foo", Arrays.<Metric<?>> asList(new Metric<Number>(
|
|
|
|
this.repository.set("foo", Arrays.<Metric<?>>asList(new Metric<Number>("foo.val",
|
|
|
|
"foo.val", 12.3), new Metric<Number>("foo.bar", 11.3)));
|
|
|
|
12.3), new Metric<Number>("foo.bar", 11.3)));
|
|
|
|
this.repository.set("bar", Arrays.<Metric<?>> asList(new Metric<Number>(
|
|
|
|
this.repository.set("bar", Arrays.<Metric<?>>asList(new Metric<Number>("bar.val",
|
|
|
|
"bar.val", 12.3), new Metric<Number>("bar.foo", 11.3)));
|
|
|
|
12.3), new Metric<Number>("bar.foo", 11.3)));
|
|
|
|
assertEquals(2, this.repository.countGroups());
|
|
|
|
assertEquals(2, this.repository.countGroups());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|