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));
}
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);
}
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"));
}
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);
}
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"));
}
Aggregations