Search in sources :

Example 1 with GenericEvent

use of org.gridkit.jvmtool.event.GenericEvent in project jvm-tools by aragozin.

the class EventDecoratorTest method verify_generic_event.

@Test
public void verify_generic_event() {
    GenericEvent a = new GenericEvent();
    a.timestamp(10000);
    a.tags().put("A", "1");
    a.tags().put("B", "2");
    a.tags().put("B", "3");
    a.tags().put("C", "4");
    a.counters().set("X", 10);
    a.counters().set("zzz", Long.MAX_VALUE);
    GenericEvent b = new GenericEvent(a);
    assertThat(b).is(eventEquals(a));
    EventDecorator deco = new EventDecorator();
    CommonEvent c = deco.wrap(b);
    assertThat(c).is(eventEquals(a));
    deco.timestamp(77777);
    deco.tags().put("F", "10");
    deco.counters().set("__", 25);
    assertThat(c.timestamp()).isEqualTo(77777);
    assertThat(c.tags()).containsOnly("A", "B", "C", "F");
    assertThat(c.counters()).containsOnly("X", "zzz", "__");
}
Also used : GenericEvent(org.gridkit.jvmtool.event.GenericEvent) EventDecorator(org.gridkit.jvmtool.event.EventDecorator) CommonEvent(org.gridkit.jvmtool.event.CommonEvent) Test(org.junit.Test)

Aggregations

CommonEvent (org.gridkit.jvmtool.event.CommonEvent)1 EventDecorator (org.gridkit.jvmtool.event.EventDecorator)1 GenericEvent (org.gridkit.jvmtool.event.GenericEvent)1 Test (org.junit.Test)1