Search in sources :

Example 76 with Description

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

the class DefaultEventContextTestCase method multipleLevelsGrandchildFirst.

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

Example 77 with Description

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

the class DefaultEventContextTestCase method successWithResult.

@Test
@Description("EventContext response publisher completes with value of result. Also given response publisher completed and there there are no child contexts the completion publisher also completes.")
public void successWithResult() throws Exception {
    CoreEvent event = testEvent();
    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)

Example 78 with Description

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

the class DefaultEventContextTestCase method error.

@Test
@Description("EventContext response publisher completes with error. Also given response publisher completed and there there are no child contexts the completion publisher also completes.")
public void error() throws Exception {
    Exception exception = new Exception();
    parent.error(exception);
    assertParent(nullValue(), is(exception), true, true);
}
Also used : MuleException(org.mule.runtime.api.exception.MuleException) ExpectedException(org.junit.rules.ExpectedException) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 79 with Description

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

the class DefaultEventContextTestCase method componentDataFromSingleComponent.

@Test
@Description("Verify that a single component location produces connector and source data.")
public void componentDataFromSingleComponent() throws Exception {
    BaseEventContext context = this.context.get();
    assertThat(context.getOriginatingLocation().getComponentIdentifier().getIdentifier().getNamespace(), is(CORE_PREFIX));
    assertThat(context.getOriginatingLocation().getComponentIdentifier().getIdentifier().getName(), is("test"));
}
Also used : BaseEventContext(org.mule.runtime.core.privileged.event.BaseEventContext) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 80 with Description

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

the class DefaultEventContextTestCase method childSuccessWithResultFreesChild.

@Test
@Description("Once a child context is completed, its event is not kept in memory.")
public void childSuccessWithResultFreesChild() throws Exception {
    child = addChild(parent);
    CoreEvent eventChild = getEventBuilder().message(Message.of(TEST_PAYLOAD)).build();
    CoreEvent eventParent = getEventBuilder().message(Message.of(TEST_PAYLOAD)).build();
    PhantomReference<CoreEvent> childRef = new PhantomReference<>(eventChild, new ReferenceQueue<>());
    child.success(eventChild);
    eventChild = null;
    childResultValue.set(null);
    new PollingProber(GC_POLLING_TIMEOUT, DEFAULT_POLLING_INTERVAL).check(new JUnitLambdaProbe(() -> {
        System.gc();
        assertThat(childRef.isEnqueued(), is(true));
        return true;
    }, "A hard reference is being mantained to the child event."));
    parent.success(eventParent);
}
Also used : JUnitLambdaProbe(org.mule.tck.probe.JUnitLambdaProbe) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) PhantomReference(java.lang.ref.PhantomReference) PollingProber(org.mule.tck.probe.PollingProber) Description(io.qameta.allure.Description) Test(org.junit.Test)

Aggregations

Description (io.qameta.allure.Description)117 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 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 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 BaseEventContext (org.mule.runtime.core.privileged.event.BaseEventContext)6 InternalProcessor (org.mule.runtime.core.privileged.processor.InternalProcessor)6 SmallTest (org.mule.tck.size.SmallTest)6 TestTransaction (org.mule.tck.testmodels.mule.TestTransaction)6