Search in sources :

Example 96 with Description

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

the class ObjectStreamingExtensionTestCase method getObjectStreamWithTargetVariable.

@Test
@Description("Stores an object stream in a variable leaving without modifying the original payload")
public void getObjectStreamWithTargetVariable() throws Exception {
    CoreEvent event = flowRunner("getStreamWithTarget").keepStreamsOpen().withPayload(data).run();
    assertThat(event.getVariables().get(MY_STREAM_VAR).getValue(), is(instanceOf(CursorIteratorProvider.class)));
    assertThat(IteratorUtils.toList(((CursorIteratorProvider) event.getVariables().get(MY_STREAM_VAR).getValue()).openCursor()), equalTo(data));
    assertThat(event.getMessage().getPayload().getValue(), is(instanceOf(List.class)));
    assertThat(event.getMessage().getPayload().getValue(), equalTo(data));
}
Also used : CursorIteratorProvider(org.mule.runtime.api.streaming.object.CursorIteratorProvider) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 97 with Description

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

the class ExtensionsClientTestCase method executeOperationWithComplexType.

@Test
@Description("Executes an operation with a complex type parameter using the client and the DefaultOperationParametersBuilder")
public void executeOperationWithComplexType() throws Throwable {
    Weapon.WeaponAttributes attributes = new Weapon.WeaponAttributes();
    attributes.setBrand("brand");
    OperationParameters params = builder().configName(HEISENBERG_CONFIG).addParameter("weapon", Ricin.class, builder().addParameter("destination", KnockeableDoor.class, builder().addParameter("address", "ADdresss").addParameter("victim", "victim!1231")).addParameter("microgramsPerKilo", 123L)).addParameter("type", FIRE_WEAPON).addParameter("attributesOfWeapon", attributes).build();
    Result<String, Object> result = doExecute(HEISENBERG_EXT_NAME, "killWithWeapon", params);
    assertThat(result.getOutput(), is("Killed with: You have been killed with Ricin , Type FIRE_WEAPON and attribute brand"));
}
Also used : OperationParameters(org.mule.runtime.extension.api.client.OperationParameters) Ricin(org.mule.test.heisenberg.extension.model.Ricin) KnockeableDoor(org.mule.test.heisenberg.extension.model.KnockeableDoor) Weapon(org.mule.test.heisenberg.extension.model.Weapon) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 98 with Description

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

the class ExtensionsClientTestCase method nonExistentExtension.

@Test
@Description("Tries to execute an operation from an extension that does not exist")
public void nonExistentExtension() throws Throwable {
    exception.expect(MuleRuntimeException.class);
    exception.expectMessage("No Extension [no-exist] Found");
    OperationParameters params = builder().configName("config").build();
    doExecute("no-exist", "operation", params);
}
Also used : OperationParameters(org.mule.runtime.extension.api.client.OperationParameters) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 99 with Description

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

the class ExtensionsClientTestCase method executeSimpleOperation.

@Test
@Description("Executes a simple operation using the client and checks the output")
public void executeSimpleOperation() throws Throwable {
    OperationParameters params = builder().configName(HEISENBERG_CONFIG).addParameter("victim", "Juani").addParameter("goodbyeMessage", "ADIOS").build();
    Result<String, Object> result = doExecute(HEISENBERG_EXT_NAME, "kill", params);
    assertThat(result.getOutput(), is("ADIOS, Juani"));
}
Also used : OperationParameters(org.mule.runtime.extension.api.client.OperationParameters) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 100 with Description

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

the class ExtensionsClientTestCase method executeOperationWithDefaultValueParameter.

@Test
@Description("Executes an operation that has a parameter with default value using the client and checks the output")
public void executeOperationWithDefaultValueParameter() throws Throwable {
    OperationParameters params = builder().configName("apple").build();
    Result<Collection<?>, Object> result = doExecute(VEGAN, "tryToEatThisListOfMaps", params);
    assertThat(result.getOutput(), instanceOf(List.class));
    assertThat(result.getOutput(), hasSize(0));
}
Also used : OperationParameters(org.mule.runtime.extension.api.client.OperationParameters) Collection(java.util.Collection) Collections.emptyList(java.util.Collections.emptyList) List(java.util.List) 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