use of eu.bcvsolutions.idm.core.api.event.CoreEvent in project CzechIdMng by bcvsolutions.
the class EntityEventProcessorUnitTest method testSuppotsAll.
@Test
public void testSuppotsAll() {
EntityEventProcessor<?> processor = new EventProcessorBase();
assertTrue(processor.supports(new IdentityEvent(IdentityEventType.UPDATE, new IdmIdentityDto())));
assertTrue(processor.supports(new IdentityEvent(IdentityEventType.DELETE, new IdmIdentityDto())));
assertTrue(processor.supports(new IdentityContractEvent(IdentityContractEventType.DELETE, new IdmIdentityContractDto())));
assertTrue(processor.supports(new CoreEvent<IdmIdentityDto>(CustomType.SAVE, new IdmIdentityDto())));
assertTrue(processor.supports(new CoreEvent<>(CustomType.CUSTOM, new IdmIdentityDto())));
assertTrue(processor.supports(new CoreEvent<IdmIdentityContractDto>(IdentityContractEventType.UPDATE, new IdmIdentityContractDto())));
}
use of eu.bcvsolutions.idm.core.api.event.CoreEvent in project CzechIdMng by bcvsolutions.
the class DefaultEntityEventManagerIntergationTest method testConfigPropertyEventTypeOverwrite.
@Test
public void testConfigPropertyEventTypeOverwrite() {
String eventTypeName = System.nanoTime() + "_test_type";
EventType type = (EventType) () -> eventTypeName;
EntityEvent<TestContentTwo> event = new CoreEvent<>(type, new TestContentTwo());
EventContext<TestContentTwo> context = entityEventManager.process(event);
assertEquals(0, context.getResults().size());
String configPropName = testTwoEntityEventProcessorOne.getConfigurationPropertyName(EntityEventProcessor.PROPERTY_EVENT_TYPES);
configurationService.setValue(configPropName, eventTypeName);
EntityEvent<TestContentTwo> event2 = new CoreEvent<>(type, new TestContentTwo());
EventContext<TestContentTwo> context2 = entityEventManager.process(event2);
assertEquals(2, context2.getResults().size());
}
use of eu.bcvsolutions.idm.core.api.event.CoreEvent in project CzechIdMng by bcvsolutions.
the class DefaultEntityEventManagerIntergationTest method testCloseEvent.
@Test
public void testCloseEvent() {
EntityEvent<TestContent> event = new CoreEvent<>(CoreEventType.CREATE, new TestContent());
event.getContent().setClose(2);
EventContext<TestContent> context = entityEventManager.process(event);
//
assertEquals(2, context.getResults().size());
assertEquals(2, context.getProcessedOrder().intValue());
assertEquals("2", context.getLastResult().getEvent().getContent().getText());
}
use of eu.bcvsolutions.idm.core.api.event.CoreEvent in project CzechIdMng by bcvsolutions.
the class DefaultEntityEventManagerIntergationTest method testStartEventInMiddle.
@Test
public void testStartEventInMiddle() {
DefaultEventContext<TestContent> initContext = new DefaultEventContext<>();
initContext.setProcessedOrder(2);
EntityEvent<TestContent> event = new CoreEvent<>(CoreEventType.CREATE, new TestContent(), null, initContext);
EventContext<TestContent> context = entityEventManager.process(event);
//
assertEquals(2, context.getResults().size());
assertEquals(4, context.getProcessedOrder().intValue());
assertEquals("4", context.getLastResult().getEvent().getContent().getText());
}
use of eu.bcvsolutions.idm.core.api.event.CoreEvent in project CzechIdMng by bcvsolutions.
the class DefaultEntityEventManagerIntergationTest method testProcessorSameOrder.
@Test
public void testProcessorSameOrder() {
EntityEvent<TestContentTwo> event = new CoreEvent<>(CoreEventType.EAV_SAVE, new TestContentTwo());
EventContext<TestContentTwo> context = entityEventManager.process(event);
//
assertEquals(2, context.getResults().size());
assertEquals(2, context.getProcessedOrder().intValue());
}
Aggregations