use of org.mule.runtime.extension.api.client.OperationParameters in project mule by mulesoft.
the class ExtensionsClientTestCase method executeOperationWithNullSafeParameter.
@Test
@Description("Executes an operation that has a @NullSafe annotated parameter using the client and checks the output")
public void executeOperationWithNullSafeParameter() throws Throwable {
OperationParameters params = builder().configName("banana").build();
Result<VeganPolicy, Object> result = doExecute(VEGAN, "applyPolicy", params);
assertThat(result.getOutput().getMeetAllowed(), is(false));
assertThat(result.getOutput().getIngredients().getSaltMiligrams(), is(0));
}
use of org.mule.runtime.extension.api.client.OperationParameters in project mule by mulesoft.
the class ExtensionsClientTestCase method executeOperationThatReturnsAttributes.
@Test
@Description("Executes an operation that returns attributes metadata using the client and checks the output and the attributes")
public void executeOperationThatReturnsAttributes() throws Throwable {
OperationParameters params = builder().configName(HEISENBERG_CONFIG).build();
Result<String, IntegerAttributes> result = doExecute(HEISENBERG_EXT_NAME, "getEnemy", params);
assertThat(result.getOutput(), is("Gustavo Fring"));
assertThat(result.getAttributes().isPresent(), is(true));
assertThat(result.getAttributes().get().getValue(), is(0));
}
use of org.mule.runtime.extension.api.client.OperationParameters in project mule by mulesoft.
the class ExtensionsClientTestCase method executeSimpleOperationWithExpression.
@Test
@Description("Executes a simple operation with an expression as parameter using the client and checks the output")
public void executeSimpleOperationWithExpression() throws Throwable {
OperationParameters params = builder().configName(HEISENBERG_CONFIG).addParameter("victim", "#[mel:'Juani']").addParameter("goodbyeMessage", "ADIOS").build();
Result<String, Object> result = doExecute(HEISENBERG_EXT_NAME, "kill", params);
assertThat(result.getOutput(), is("ADIOS, Juani"));
}
use of org.mule.runtime.extension.api.client.OperationParameters in project mule by mulesoft.
the class ExtensionsClientTestCase method executeFailureOperation.
@Test
@Description("Executes an operation that fails using the client and checks the throwed exception")
public void executeFailureOperation() throws Throwable {
exception.expect(MuleException.class);
exception.expectCause(instanceOf(ConnectionException.class));
exception.expectMessage("You are not allowed to speak with gus.");
OperationParameters params = builder().configName(HEISENBERG_CONFIG).build();
doExecute(HEISENBERG_EXT_NAME, "callGusFring", params);
}
use of org.mule.runtime.extension.api.client.OperationParameters in project mule by mulesoft.
the class ExtensionsClientTestCase method executeVoidOperation.
@Test
@Description("Executes a void operation using the client")
public void executeVoidOperation() throws Throwable {
OperationParameters params = builder().configName(HEISENBERG_CONFIG).build();
Result<Object, Object> result = doExecute(HEISENBERG_EXT_NAME, "die", params);
assertThat(result.getOutput(), is(nullValue()));
assertThat(result.getAttributes().isPresent(), is(false));
}
Aggregations