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));
}
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", "__");
}
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);
}
Aggregations