Search in sources :

Example 11 with Description

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

the class DefaultExpressionManagerTestCase method flowVars.

@Test
@Description("Verifies that flowVars work, returning null for non existent ones and it's value for those that do.")
public void flowVars() throws MuleException {
    CoreEvent.Builder eventBuilder = CoreEvent.builder(testEvent());
    String flowVars = "vars.myVar";
    assertThat(expressionManager.evaluate(flowVars, eventBuilder.build()).getValue(), nullValue());
    String value = "Leda";
    eventBuilder.addVariable(MY_VAR, value);
    assertThat(expressionManager.evaluate(flowVars, eventBuilder.build()).getValue(), is(value));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.anyString(org.mockito.Matchers.anyString) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 12 with Description

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

the class DefaultExpressionManagerTestCase method simple.

@Test
@Description("Verifies that a simple literal expression is successful.")
public void simple() {
    String expression = "\"wow\"";
    assertString(expression);
}
Also used : Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.anyString(org.mockito.Matchers.anyString) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 13 with Description

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

the class StreamingUtilsTestCase method consumeRepeatableIteratorPayload.

@Test
@Description("Test that repeatable iterator is consumed into a list")
public void consumeRepeatableIteratorPayload() throws Exception {
    CursorIteratorProvider payload = asCursorProvider(TEST_LIST);
    CoreEvent event = consumeRepeatablePayload(getEventBuilder().message(Message.of(payload)).build());
    assertConsumedObjectStream(payload, event);
}
Also used : InMemoryCursorIteratorProvider(org.mule.runtime.core.internal.streaming.object.InMemoryCursorIteratorProvider) CursorIteratorProvider(org.mule.runtime.api.streaming.object.CursorIteratorProvider) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Description(io.qameta.allure.Description) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 14 with Description

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

the class StreamingUtilsTestCase method consumeJsonRepeatableInputStreamPayload.

@Test
@Description("Test that repeatable stream in the payload is consumed into another fully in memory stream provider while maintaining " + "the original media type")
public void consumeJsonRepeatableInputStreamPayload() throws Exception {
    CursorStreamProvider payload = asCursorProvider(TEST_PAYLOAD);
    CoreEvent event = consumeRepeatablePayload(getEventBuilder().message(Message.builder().payload(TypedValue.of(payload)).mediaType(APPLICATION_JSON).build()).build());
    assertConsumedRepeatableInputStream(payload, event);
    assertThat(event.getMessage().getPayload().getDataType().getMediaType(), is(APPLICATION_JSON));
}
Also used : InMemoryCursorStreamProvider(org.mule.runtime.core.api.streaming.bytes.InMemoryCursorStreamProvider) CursorStreamProvider(org.mule.runtime.api.streaming.bytes.CursorStreamProvider) ByteArrayCursorStreamProvider(org.mule.runtime.core.internal.streaming.bytes.ByteArrayCursorStreamProvider) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Description(io.qameta.allure.Description) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 15 with Description

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

the class SplitAggregateScopeTestCase method customTargetDefaultPayload.

@Test
@Description("When a custom target is configured the router result is set in a variable and the input event is output.")
public void customTargetDefaultPayload() throws Exception {
    final String variableName = "foo";
    CoreEvent original = createListEvent();
    MessageProcessorChain nested = newChain(empty(), event -> event);
    nested.setMuleContext(muleContext);
    router.setMessageProcessors(singletonList(nested));
    router.setTarget(variableName);
    muleContext.getInjector().inject(router);
    router.setAnnotations(getAppleFlowComponentLocationAnnotations());
    router.initialise();
    Event result = router.process(original);
    assertThat(result.getMessage(), equalTo(original.getMessage()));
    final TypedValue<?> typedValue = result.getVariables().get(variableName);
    assertThat(typedValue.getValue(), instanceOf(List.class));
    assertThat(List.class.isAssignableFrom(typedValue.getDataType().getType()), is(true));
    List<Message> resultList = (List<Message>) typedValue.getValue();
    assertThat(resultList, hasSize(2));
}
Also used : MessageProcessorChain(org.mule.runtime.core.privileged.processor.chain.MessageProcessorChain) Message(org.mule.runtime.api.message.Message) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Event(org.mule.runtime.api.event.Event) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Collections.singletonList(java.util.Collections.singletonList) List(java.util.List) ArrayList(java.util.ArrayList) 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