use of io.qameta.allure.Description in project mule by mulesoft.
the class DefaultEventContextTestCase method asyncChild.
@Test
@Description("Parent EventContext only completes once response publisher completes with a value and all child contexts are complete, even when child is run async with a delay.")
public void asyncChild() throws Exception {
child = addChild(parent);
CoreEvent event = testEvent();
Scheduler testScheduler = muleContext.getSchedulerService().ioScheduler();
Latch latch1 = new Latch();
try {
testScheduler.submit(() -> {
child.success(event);
latch1.countDown();
return null;
});
assertParent(is(nullValue()), is(nullValue()), false, false);
parent.success(event);
latch1.await();
assertChild(is(event), is(nullValue()), true);
assertParent(is(event), is(nullValue()), true, true);
} finally {
testScheduler.stop();
}
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class DefaultEventContextTestCase method multipleBranches.
@Test
@Description("Parent EventContext only completes once response publisher completes with a value and all child contexts are complete, even if one branch of the tree completes.")
public void multipleBranches() throws Exception {
BaseEventContext parent = context.get();
BaseEventContext child1 = child(parent, empty());
BaseEventContext child2 = child(parent, empty());
BaseEventContext grandchild1 = child(child1, empty());
BaseEventContext grandchild2 = child(child1, empty());
BaseEventContext grandchild3 = child(child2, empty());
BaseEventContext grandchild4 = child(child2, empty());
grandchild1.success();
grandchild2.success();
assertThat(grandchild1.isTerminated(), is(true));
assertThat(grandchild2.isTerminated(), is(true));
assertThat(child1.isTerminated(), is(false));
assertThat(parent.isTerminated(), is(false));
child1.success();
assertThat(child1.isTerminated(), is(true));
assertThat(parent.isTerminated(), is(false));
grandchild3.success();
grandchild4.success();
child2.success();
assertThat(grandchild3.isTerminated(), is(true));
assertThat(grandchild4.isTerminated(), is(true));
assertThat(child2.isTerminated(), is(true));
assertThat(parent.isTerminated(), is(false));
parent.success();
assertThat(parent.isTerminated(), is(true));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class TransactionAwareWorkQueueProcessingStrategyTestCase method tx.
@Test
@Override
@Description("Unlike with the MultiReactorProcessingStrategy, the TransactionAwareWorkQueueProcessingStrategy does not fail if a transaction " + "is active, but rather executes these events synchronously in the caller thread transparently.")
public void tx() throws Exception {
flow = flowBuilder.get().processors(cpuLightProcessor, cpuIntensiveProcessor, blockingProcessor).build();
flow.initialise();
flow.start();
TransactionCoordination.getInstance().bindTransaction(new TestTransaction(muleContext));
processFlow(testEvent());
assertThat(threads, hasSize(equalTo(1)));
assertThat(threads, not(hasItem(startsWith(CPU_LIGHT))));
assertThat(threads, not(hasItem(startsWith(IO))));
assertThat(threads, not(hasItem(startsWith(CPU_INTENSIVE))));
assertThat(threads, not(hasItem(startsWith(CUSTOM))));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class TransactionAwareWorkQueueStreamProcessingStrategyTestCase method tx.
@Override
@Description("Unlike with the MultiReactorProcessingStrategy, the TransactionAwareWorkQueueProcessingStrategy does not fail if a transaction " + "is active, but rather executes these events synchronously in the caller thread transparently.")
public void tx() throws Exception {
flow = flowBuilder.get().processors(cpuLightProcessor, cpuIntensiveProcessor, blockingProcessor).build();
flow.initialise();
flow.start();
TransactionCoordination.getInstance().bindTransaction(new TestTransaction(muleContext));
processFlow(testEvent());
assertThat(threads, hasSize(equalTo(1)));
assertThat(threads, not(hasItem(startsWith(CPU_LIGHT))));
assertThat(threads, not(hasItem(startsWith(IO))));
assertThat(threads, not(hasItem(startsWith(CPU_INTENSIVE))));
assertThat(threads, not(hasItem(startsWith(CUSTOM))));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class WorkQueueProcessingStrategyTestCase method tx.
@Override
@Description("When the WorkQueueProcessingStrategy is configured and a transaction is active processing fails with an error")
public void tx() throws Exception {
flow = flowBuilder.get().processors(cpuLightProcessor, cpuIntensiveProcessor, blockingProcessor).build();
flow.initialise();
flow.start();
TransactionCoordination.getInstance().bindTransaction(new TestTransaction(muleContext));
expectedException.expect(MessagingException.class);
expectedException.expectCause(instanceOf(DefaultMuleException.class));
expectedException.expectCause(hasMessage(equalTo(TRANSACTIONAL_ERROR_MESSAGE)));
processFlow(testEvent());
}
Aggregations