Search in sources :

Example 36 with Description

use of io.qameta.allure.Description in project mule by mulesoft.

the class ProactorStreamProcessingStrategyTestCase method blockingRejectedExecution.

@Test
@Description("If IO pool is busy OVERLOAD error is thrown")
public void blockingRejectedExecution() throws Exception {
    Scheduler blockingSchedulerSpy = spy(blocking);
    Scheduler rejectingSchedulerSpy = spy(new RejectingScheduler(blockingSchedulerSpy));
    flow = flowBuilder.get().processors(blockingProcessor).processingStrategyFactory((context, prefix) -> new ProactorStreamProcessingStrategy(() -> ringBuffer, DEFAULT_BUFFER_SIZE, 1, DEFAULT_WAIT_STRATEGY, () -> cpuLight, () -> rejectingSchedulerSpy, () -> cpuIntensive, 1, 2)).build();
    flow.initialise();
    flow.start();
    processFlow(testEvent());
    verify(rejectingSchedulerSpy, times(11)).submit(any(Callable.class));
    verify(blockingSchedulerSpy, times(1)).submit(any(Callable.class));
    assertThat(threads, hasSize(1));
    assertThat(threads.stream().filter(name -> name.startsWith(IO)).count(), equalTo(1l));
    assertThat(threads, not(hasItem(startsWith(CPU_LIGHT))));
    assertThat(threads, not(hasItem(startsWith(CPU_INTENSIVE))));
    assertThat(threads, not(hasItem(startsWith(CUSTOM))));
}
Also used : ProactorStreamProcessingStrategy(org.mule.runtime.core.internal.processor.strategy.ProactorStreamProcessingStrategyFactory.ProactorStreamProcessingStrategy) Scheduler(org.mule.runtime.api.scheduler.Scheduler) Callable(java.util.concurrent.Callable) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 37 with Description

use of io.qameta.allure.Description in project mule by mulesoft.

the class ReactorProcessingStrategyTestCase method tx.

@Override
@Description("When the ReactorProcessingStrategy 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());
}
Also used : DefaultMuleException(org.mule.runtime.api.exception.DefaultMuleException) TestTransaction(org.mule.tck.testmodels.mule.TestTransaction) Description(io.qameta.allure.Description)

Example 38 with Description

use of io.qameta.allure.Description in project mule by mulesoft.

the class ReactorProcessingStrategyTestCase method cpuLightRejectedExecution.

@Test
@Description("If CPU LITE pool is busy OVERLOAD error is thrown")
public void cpuLightRejectedExecution() throws Exception {
    flow = flowBuilder.get().processors(blockingProcessor).processingStrategyFactory((context, prefix) -> new ReactorProcessingStrategy(() -> new RejectingScheduler(cpuLight))).build();
    flow.initialise();
    flow.start();
    expectRejected();
    processFlow(testEvent());
}
Also used : ReactorProcessingStrategy(org.mule.runtime.core.internal.processor.strategy.ReactorProcessingStrategyFactory.ReactorProcessingStrategy) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 39 with Description

use of io.qameta.allure.Description in project mule by mulesoft.

the class TransactionAwareProactorStreamProcessingStrategyTestCase 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))));
}
Also used : TestTransaction(org.mule.tck.testmodels.mule.TestTransaction) Description(io.qameta.allure.Description)

Example 40 with Description

use of io.qameta.allure.Description in project mule by mulesoft.

the class DefaultEventContextTestCase method childSuccessWithResult.

@Test
@Description("Parent EventContext only completes once response publisher completes with a value and all child contexts are complete.")
public void childSuccessWithResult() throws Exception {
    child = addChild(parent);
    CoreEvent event = testEvent();
    child.success(event);
    assertChild(is(event), is(nullValue()), true);
    assertParent(is(nullValue()), is(nullValue()), false, false);
    parent.success(event);
    assertParent(is(event), is(nullValue()), true, true);
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Description(io.qameta.allure.Description) Test(org.junit.Test)

Aggregations

Description (io.qameta.allure.Description)123 Test (org.junit.Test)111 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)41 Matchers.containsString (org.hamcrest.Matchers.containsString)15 Message (org.mule.runtime.api.message.Message)13 TypedValue (org.mule.runtime.api.metadata.TypedValue)13 RoutingPair (org.mule.runtime.core.internal.routing.ForkJoinStrategy.RoutingPair)12 MessageProcessorChain (org.mule.runtime.core.privileged.processor.chain.MessageProcessorChain)12 OperationParameters (org.mule.runtime.extension.api.client.OperationParameters)12 Issue (io.qameta.allure.Issue)10 Matchers.anyString (org.mockito.Matchers.anyString)8 List (java.util.List)7 MavenConfiguration (org.mule.maven.client.api.model.MavenConfiguration)7 Processor (org.mule.runtime.core.api.processor.Processor)7 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)6 PropertyCommand (com.axibase.tsd.api.model.command.PropertyCommand)6 Property (com.axibase.tsd.api.model.property.Property)6 RemoteRepository (org.mule.maven.client.api.model.RemoteRepository)6 Event (org.mule.runtime.api.event.Event)6 ReactiveProcessor (org.mule.runtime.core.api.processor.ReactiveProcessor)6