Search in sources :

Example 11 with Pair

use of net.opentsdb.utils.Pair in project opentsdb by OpenTSDB.

the class TestTags method parseWithMetricListNullTagk2.

@Test
public void parseWithMetricListNullTagk2() {
    final List<Pair<String, String>> tags = new ArrayList<Pair<String, String>>(2);
    final String metric = Tags.parseWithMetric("sys.cpu.user{host=web01,=lga}", tags);
    assertEquals("sys.cpu.user", metric);
    assertEquals(2, tags.size());
    assertEquals("host", tags.get(0).getKey());
    assertEquals("web01", tags.get(0).getValue());
    assertNull(tags.get(1).getKey());
    assertEquals("lga", tags.get(1).getValue());
}
Also used : ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString) Pair(net.opentsdb.utils.Pair) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 12 with Pair

use of net.opentsdb.utils.Pair in project opentsdb by OpenTSDB.

the class TestTags method parseWithMetricListNullTagk.

@Test
public void parseWithMetricListNullTagk() {
    final List<Pair<String, String>> tags = new ArrayList<Pair<String, String>>(1);
    final String metric = Tags.parseWithMetric("sys.cpu.user{=web01}", tags);
    assertEquals("sys.cpu.user", metric);
    assertEquals(1, tags.size());
    assertNull(tags.get(0).getKey());
    assertEquals("web01", tags.get(0).getValue());
}
Also used : ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString) Pair(net.opentsdb.utils.Pair) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 13 with Pair

use of net.opentsdb.utils.Pair in project opentsdb by OpenTSDB.

the class TestTags method parseWithMetricListNullTagv2.

@Test
public void parseWithMetricListNullTagv2() {
    final List<Pair<String, String>> tags = new ArrayList<Pair<String, String>>(2);
    final String metric = Tags.parseWithMetric("sys.cpu.user{host=web01,dc=}", tags);
    assertEquals("sys.cpu.user", metric);
    assertEquals(2, 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());
}
Also used : ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString) Pair(net.opentsdb.utils.Pair) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

Pair (net.opentsdb.utils.Pair)13 ArrayList (java.util.ArrayList)11 Test (org.junit.Test)10 Matchers.anyString (org.mockito.Matchers.anyString)10 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)10 SearchQuery (net.opentsdb.search.SearchQuery)2 DataPoints (net.opentsdb.core.DataPoints)1 Query (net.opentsdb.core.Query)1 TSQuery (net.opentsdb.core.TSQuery)1 TSSubQuery (net.opentsdb.core.TSSubQuery)1 TimeSeriesLookup (net.opentsdb.search.TimeSeriesLookup)1