use of io.kubernetes.client.extended.event.legacy.EventLogger in project java by kubernetes-client.
the class EventLoggerTest method testPatchComputing.
@Test
public void testPatchComputing() {
CoreV1Event event1 = new CoreV1EventBuilder().withSource(new V1EventSourceBuilder().build()).withMetadata(new V1ObjectMeta()).withInvolvedObject(new V1ObjectReferenceBuilder().build()).withCount(1).withMessage("foo1").build();
CoreV1Event event2 = new CoreV1EventBuilder().withSource(new V1EventSourceBuilder().build()).withMetadata(new V1ObjectMeta()).withInvolvedObject(new V1ObjectReferenceBuilder().build()).withCount(2).withMessage("foo2").build();
String aggregatedKey = EventUtils.getAggregatedAndLocalKeyByReason(event1).getRight();
EventLogger eventLogger = new EventLogger(100, EventUtils::getEventKey);
MutablePair<CoreV1Event, V1Patch> result1 = eventLogger.observe(event1, aggregatedKey);
assertEquals(event1, result1.getLeft());
assertNull(result1.getRight());
MutablePair<CoreV1Event, V1Patch> result2 = eventLogger.observe(event2, aggregatedKey);
assertEquals(event2, result2.getLeft());
assertNotNull(result2.getRight());
}
Aggregations