use of net.opentsdb.utils.Pair in project opentsdb by OpenTSDB.
the class TestTags method parseWithMetricListNullTagv3.
@Test
public void parseWithMetricListNullTagv3() {
final List<Pair<String, String>> tags = new ArrayList<Pair<String, String>>(3);
final String metric = Tags.parseWithMetric("sys.cpu.user{host=web01,dc=,=root}", tags);
assertEquals("sys.cpu.user", metric);
assertEquals(3, tags.size());
assertEquals("host", tags.get(0).getKey());
assertEquals("web01", tags.get(0).getValue());
assertEquals("dc", tags.get(1).getKey());
assertNull(tags.get(1).getValue());
assertNull(tags.get(2).getKey());
assertEquals("root", tags.get(2).getValue());
}
use of net.opentsdb.utils.Pair in project opentsdb by OpenTSDB.
the class TestTags method parseWithMetricListMetricOnly.
@Test
public void parseWithMetricListMetricOnly() {
final List<Pair<String, String>> tags = new ArrayList<Pair<String, String>>(0);
final String metric = Tags.parseWithMetric("sys.cpu.user", tags);
assertEquals("sys.cpu.user", metric);
assertEquals(0, tags.size());
}
use of net.opentsdb.utils.Pair in project opentsdb by OpenTSDB.
the class TestTags method parseWithMetricListMetricEmptyCurlies.
@Test
public void parseWithMetricListMetricEmptyCurlies() {
final List<Pair<String, String>> tags = new ArrayList<Pair<String, String>>(0);
final String metric = Tags.parseWithMetric("sys.cpu.user{}", tags);
assertEquals("sys.cpu.user", metric);
assertEquals(0, tags.size());
}
use of net.opentsdb.utils.Pair in project opentsdb by OpenTSDB.
the class TestTags method parseWithMetricListNullMetric.
@Test
public void parseWithMetricListNullMetric() {
final List<Pair<String, String>> tags = new ArrayList<Pair<String, String>>(1);
final String metric = Tags.parseWithMetric("{host=}", tags);
assertNull(metric);
assertEquals(1, tags.size());
assertEquals("host", tags.get(0).getKey());
assertNull(tags.get(0).getValue());
}
use of net.opentsdb.utils.Pair in project opentsdb by OpenTSDB.
the class TestTags method parseWithMetricListNullTagv.
@Test
public void parseWithMetricListNullTagv() {
final List<Pair<String, String>> tags = new ArrayList<Pair<String, String>>(1);
final String metric = Tags.parseWithMetric("sys.cpu.user{host=}", tags);
assertEquals("sys.cpu.user", metric);
assertEquals(1, tags.size());
assertEquals("host", tags.get(0).getKey());
assertNull(tags.get(0).getValue());
}
Aggregations