Search in sources :

Example 1 with EventDecorator

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

the class EventDecoratorTest method verify_error_event.

@Test
public void verify_error_event() {
    SimpleErrorEvent ee = new SimpleErrorEvent(new Exception("Boom"));
    EventDecorator deco = new EventDecorator();
    ErrorEvent c = deco.wrap(ee);
    assertThat(c).is(eventEquals(ee));
}
Also used : SimpleErrorEvent(org.gridkit.jvmtool.event.SimpleErrorEvent) EventDecorator(org.gridkit.jvmtool.event.EventDecorator) SimpleErrorEvent(org.gridkit.jvmtool.event.SimpleErrorEvent) ErrorEvent(org.gridkit.jvmtool.event.ErrorEvent) Test(org.junit.Test)

Example 2 with EventDecorator

use of org.gridkit.jvmtool.event.EventDecorator 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)

Example 3 with EventDecorator

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

the class EventDecoratorTest method verify_thread_snapshot_event.

@Test
public void verify_thread_snapshot_event() {
    ThreadSnapshotEventPojo a = new ThreadSnapshotEventPojo();
    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);
    a.threadName("Test");
    a.threadState(State.NEW);
    ThreadSnapshotEventPojo b = new ThreadSnapshotEventPojo();
    b.loadFrom(a);
    assertThat(b).is(eventEquals(a));
    EventDecorator deco = new EventDecorator();
    ThreadSnapshotEvent 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", "__");
    assertThat(c.threadName()).isEqualTo("Test");
    assertThat(c.threadState()).isEqualTo(State.NEW);
}
Also used : ThreadSnapshotEvent(org.gridkit.jvmtool.codec.stacktrace.ThreadSnapshotEvent) EventDecorator(org.gridkit.jvmtool.event.EventDecorator) ThreadSnapshotEventPojo(org.gridkit.jvmtool.codec.stacktrace.ThreadSnapshotEventPojo) Test(org.junit.Test)

Aggregations

EventDecorator (org.gridkit.jvmtool.event.EventDecorator)3 Test (org.junit.Test)3 ThreadSnapshotEvent (org.gridkit.jvmtool.codec.stacktrace.ThreadSnapshotEvent)1 ThreadSnapshotEventPojo (org.gridkit.jvmtool.codec.stacktrace.ThreadSnapshotEventPojo)1 CommonEvent (org.gridkit.jvmtool.event.CommonEvent)1 ErrorEvent (org.gridkit.jvmtool.event.ErrorEvent)1 GenericEvent (org.gridkit.jvmtool.event.GenericEvent)1 SimpleErrorEvent (org.gridkit.jvmtool.event.SimpleErrorEvent)1