Search in sources :

Example 1 with HostMetricTagsPair

use of com.wavefront.common.HostMetricTagsPair in project java by wavefrontHQ.

the class HostMetricTagsPairTest method testGetHost.

@Test
public void testGetHost() {
    HostMetricTagsPair hostMetricTagsPair = new HostMetricTagsPair("host", "metric", null);
    Assert.assertEquals(hostMetricTagsPair.getHost(), "host");
}
Also used : HostMetricTagsPair(com.wavefront.common.HostMetricTagsPair) Test(org.junit.Test)

Example 2 with HostMetricTagsPair

use of com.wavefront.common.HostMetricTagsPair in project java by wavefrontHQ.

the class HostMetricTagsPairTest method testGetMetric.

@Test
public void testGetMetric() {
    HostMetricTagsPair hostMetricTagsPair = new HostMetricTagsPair("host", "metric", null);
    Assert.assertEquals(hostMetricTagsPair.getMetric(), "metric");
}
Also used : HostMetricTagsPair(com.wavefront.common.HostMetricTagsPair) Test(org.junit.Test)

Example 3 with HostMetricTagsPair

use of com.wavefront.common.HostMetricTagsPair in project java by wavefrontHQ.

the class HostMetricTagsPairTest method testEquals.

@Test
public void testEquals() throws Exception {
    Map<String, String> tags1 = new HashMap<>();
    tags1.put("key1", "value1");
    HostMetricTagsPair hostMetricTagsPair1 = new HostMetricTagsPair("host1", "metric1", tags1);
    // equals itself
    Assert.assertTrue(hostMetricTagsPair1.equals(hostMetricTagsPair1));
    // same hostMetricTagsPair
    HostMetricTagsPair hostMetricTagsPair2 = new HostMetricTagsPair("host1", "metric1", tags1);
    Assert.assertTrue(hostMetricTagsPair1.equals(hostMetricTagsPair2));
    // compare different host with hostMetricTagsPair1
    HostMetricTagsPair hostMetricTagsPair3 = new HostMetricTagsPair("host2", "metric1", tags1);
    Assert.assertFalse(hostMetricTagsPair1.equals(hostMetricTagsPair3));
    // compare different metric with hostMetricTagsPair1
    HostMetricTagsPair hostMetricTagsPair4 = new HostMetricTagsPair("host1", "metric2", tags1);
    Assert.assertFalse(hostMetricTagsPair1.equals(hostMetricTagsPair4));
    // compare different tags with hostMetricTagsPair1
    Map<String, String> tags2 = new HashMap<>();
    tags2.put("key2", "value2");
    HostMetricTagsPair hostMetricTagsPair5 = new HostMetricTagsPair("host1", "metric1", tags2);
    Assert.assertFalse(hostMetricTagsPair1.equals(hostMetricTagsPair5));
    // compare empty tags with hostMetricTagsPair1
    HostMetricTagsPair hostMetricTagsPair6 = new HostMetricTagsPair("host1", "metric1", null);
    Assert.assertFalse(hostMetricTagsPair1.equals(hostMetricTagsPair6));
}
Also used : HashMap(java.util.HashMap) HostMetricTagsPair(com.wavefront.common.HostMetricTagsPair) Test(org.junit.Test)

Example 4 with HostMetricTagsPair

use of com.wavefront.common.HostMetricTagsPair in project java by wavefrontHQ.

the class HostMetricTagsPairTest method testGetTags.

@Test
public void testGetTags() {
    Map<String, String> tags = new HashMap<>();
    tags.put("key", "value");
    HostMetricTagsPair hostMetricTagsPair = new HostMetricTagsPair("host", "metric", tags);
    Assert.assertEquals(hostMetricTagsPair.getTags(), tags);
}
Also used : HashMap(java.util.HashMap) HostMetricTagsPair(com.wavefront.common.HostMetricTagsPair) Test(org.junit.Test)

Example 5 with HostMetricTagsPair

use of com.wavefront.common.HostMetricTagsPair in project java by wavefrontHQ.

the class HostMetricTagsPairTest method testToString.

@Test
public void testToString() throws Exception {
    Map<String, String> tags = new HashMap<>();
    tags.put("key", "value");
    HostMetricTagsPair hostMetricTagsPair = new HostMetricTagsPair("host", "metric", tags);
    Assert.assertEquals(hostMetricTagsPair.toString(), "[host: host, metric: metric, tags: " + "{key=value}]");
}
Also used : HashMap(java.util.HashMap) HostMetricTagsPair(com.wavefront.common.HostMetricTagsPair) Test(org.junit.Test)

Aggregations

HostMetricTagsPair (com.wavefront.common.HostMetricTagsPair)6 Test (org.junit.Test)5 HashMap (java.util.HashMap)3 AtomicDouble (com.google.common.util.concurrent.AtomicDouble)1 DeltaCounterValueException (com.wavefront.data.DeltaCounterValueException)1