Search in sources :

Example 6 with CoreEvent

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())));
}
Also used : IdentityEvent(eu.bcvsolutions.idm.core.model.event.IdentityEvent) CoreEvent(eu.bcvsolutions.idm.core.api.event.CoreEvent) IdentityContractEvent(eu.bcvsolutions.idm.core.model.event.IdentityContractEvent) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) AbstractVerifiableUnitTest(eu.bcvsolutions.idm.test.api.AbstractVerifiableUnitTest) Test(org.junit.Test)

Example 7 with CoreEvent

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());
}
Also used : IdentityEventType(eu.bcvsolutions.idm.core.model.event.IdentityEvent.IdentityEventType) CoreEventType(eu.bcvsolutions.idm.core.api.event.CoreEvent.CoreEventType) EventType(eu.bcvsolutions.idm.core.api.event.EventType) CoreEvent(eu.bcvsolutions.idm.core.api.event.CoreEvent) TestContentTwo(eu.bcvsolutions.idm.core.event.TestContentTwo) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 8 with CoreEvent

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());
}
Also used : CoreEvent(eu.bcvsolutions.idm.core.api.event.CoreEvent) TestContent(eu.bcvsolutions.idm.core.event.TestContent) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 9 with CoreEvent

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());
}
Also used : CoreEvent(eu.bcvsolutions.idm.core.api.event.CoreEvent) DefaultEventContext(eu.bcvsolutions.idm.core.api.event.DefaultEventContext) TestContent(eu.bcvsolutions.idm.core.event.TestContent) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 10 with CoreEvent

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());
}
Also used : CoreEvent(eu.bcvsolutions.idm.core.api.event.CoreEvent) TestContentTwo(eu.bcvsolutions.idm.core.event.TestContentTwo) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

CoreEvent (eu.bcvsolutions.idm.core.api.event.CoreEvent)18 Test (org.junit.Test)11 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)8 TestContent (eu.bcvsolutions.idm.core.event.TestContent)5 CoreEventType (eu.bcvsolutions.idm.core.api.event.CoreEvent.CoreEventType)4 IntrospectionException (java.beans.IntrospectionException)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 SysSyncItemLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto)3 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)3 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)3 EventType (eu.bcvsolutions.idm.core.api.event.EventType)3 IdentityEvent (eu.bcvsolutions.idm.core.model.event.IdentityEvent)3 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)3 AbstractVerifiableUnitTest (eu.bcvsolutions.idm.test.api.AbstractVerifiableUnitTest)3 UUID (java.util.UUID)3 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)2 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)2 SysSyncActionLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto)2 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)2 Identifiable (eu.bcvsolutions.idm.core.api.domain.Identifiable)2