Search in sources :

Example 1 with TestContent

use of eu.bcvsolutions.idm.core.event.TestContent 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 2 with TestContent

use of eu.bcvsolutions.idm.core.event.TestContent 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 3 with TestContent

use of eu.bcvsolutions.idm.core.event.TestContent in project CzechIdMng by bcvsolutions.

the class DefaultEntityEventManagerIntergationTest method testSameOrderBeansOrder.

@Test
public void testSameOrderBeansOrder() {
    EntityEvent<TestContent> event = new CoreEvent<>(TestEntityEventProcessorConfiguration.EVENT_TYPE_ORDER, new TestContent());
    EventContext<TestContent> context = entityEventManager.process(event);
    // 
    // Look out: processors are executed in random order in configured order is same
    assertEquals(7, context.getResults().size());
}
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 4 with TestContent

use of eu.bcvsolutions.idm.core.event.TestContent in project CzechIdMng by bcvsolutions.

the class DefaultEntityEventManagerIntergationTest method testSuspendEvent.

@Test
public void testSuspendEvent() {
    EntityEvent<TestContent> event = new CoreEvent<>(CoreEventType.CREATE, new TestContent());
    event.getContent().setSuspend(1);
    EventContext<TestContent> context = entityEventManager.process(event);
    // 
    assertEquals(1, context.getResults().size());
    assertEquals(1, context.getProcessedOrder().intValue());
    assertEquals("1", context.getLastResult().getEvent().getContent().getText());
    // 
    event.getContent().setSuspend(3);
    context = entityEventManager.process(event);
    // 
    assertEquals(3, context.getResults().size());
    assertEquals(3, context.getProcessedOrder().intValue());
    assertEquals("3", context.getLastResult().getEvent().getContent().getText());
    // 
    event.getContent().setSuspend(null);
    context = entityEventManager.process(event);
    // 
    assertEquals(4, 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) TestContent(eu.bcvsolutions.idm.core.event.TestContent) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 5 with TestContent

use of eu.bcvsolutions.idm.core.event.TestContent in project CzechIdMng by bcvsolutions.

the class DefaultEntityEventManagerIntergationTest method testEventGreenLine.

@Test
public void testEventGreenLine() {
    EntityEvent<TestContent> event = new CoreEvent<>(CoreEventType.CREATE, new TestContent());
    EventContext<TestContent> context = entityEventManager.process(event);
    // 
    assertEquals(4, 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) TestContent(eu.bcvsolutions.idm.core.event.TestContent) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

CoreEvent (eu.bcvsolutions.idm.core.api.event.CoreEvent)5 TestContent (eu.bcvsolutions.idm.core.event.TestContent)5 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)5 Test (org.junit.Test)5 DefaultEventContext (eu.bcvsolutions.idm.core.api.event.DefaultEventContext)1