Search in sources :

Example 6 with OperationParameters

use of org.mule.runtime.extension.api.client.OperationParameters in project mule by mulesoft.

the class ExtensionsClientTestCase method executeOperationWithParameterGroup.

@Test
@Description("Executes an operation that has a parameter group using the client and checks the output")
public void executeOperationWithParameterGroup() throws Throwable {
    OperationParameters params = builder().configName(HEISENBERG_CONFIG).addParameter("greeting", "jeje").addParameter("age", 23).addParameter("name", "Juani").addParameter("knownAddresses", emptyList()).build();
    Result<String, Object> result = doExecute(HEISENBERG_EXT_NAME, "alias", params);
    assertThat(result.getOutput(), is(ALIAS_OUTPUT));
}
Also used : OperationParameters(org.mule.runtime.extension.api.client.OperationParameters) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 7 with OperationParameters

use of org.mule.runtime.extension.api.client.OperationParameters in project mule by mulesoft.

the class ExtensionsClientTestCase method nonExistentOperation.

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

Example 8 with OperationParameters

use of org.mule.runtime.extension.api.client.OperationParameters 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 9 with OperationParameters

use of org.mule.runtime.extension.api.client.OperationParameters 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 10 with OperationParameters

use of org.mule.runtime.extension.api.client.OperationParameters 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)

Aggregations

Description (io.qameta.allure.Description)12 Test (org.junit.Test)12 OperationParameters (org.mule.runtime.extension.api.client.OperationParameters)12 Collection (java.util.Collection)1 Collections.emptyList (java.util.Collections.emptyList)1 List (java.util.List)1 ConnectionException (org.mule.runtime.api.connection.ConnectionException)1 KnockeableDoor (org.mule.test.heisenberg.extension.model.KnockeableDoor)1 Ricin (org.mule.test.heisenberg.extension.model.Ricin)1 Weapon (org.mule.test.heisenberg.extension.model.Weapon)1 IntegerAttributes (org.mule.test.heisenberg.extension.model.types.IntegerAttributes)1 VeganPolicy (org.mule.test.vegan.extension.VeganPolicy)1