use of org.mule.test.heisenberg.extension.model.KnockeableDoor in project mule by mulesoft.
the class StackableTypesTestCase method configurationWithStaticParameterResolvers.
@Test
public void configurationWithStaticParameterResolvers() throws Exception {
NestedWrapperTypesConfig config = getPayload("configurationWithStaticParameterResolvers");
ParameterResolver<TypedValue<KnockeableDoor>> doorResolver = config.getDoorResolver();
TypedValue<KnockeableDoor> doorTypedValue = doorResolver.resolve();
KnockeableDoor door = doorTypedValue.getValue();
assertThat(door.getVictim(), is("Victim's Name"));
ParameterResolver<TypedValue<String>> lazyParameter = config.getLazyString();
Optional<String> expression = lazyParameter.getExpression();
TypedValue<String> resolve = lazyParameter.resolve();
assertThat(expression, is(empty()));
assertThat(resolve.getValue(), is("a nice looking string"));
ParameterResolver<Literal<String>> resolverOfLiteral = config.getResolverOfLiteral();
Literal<String> stringLiteral = resolverOfLiteral.resolve();
Optional<String> literalValue = stringLiteral.getLiteralValue();
assertThat(literalValue, is(not(empty())));
assertThat(literalValue.get(), is("this doesn't make sense"));
}
use of org.mule.test.heisenberg.extension.model.KnockeableDoor in project mule by mulesoft.
the class FunctionExecutionTestCase method executeWithTypedValueParameters.
@Test
public void executeWithTypedValueParameters() throws Exception {
final String xmlString = IOUtils.toString(getDocumentStream());
final InputStream jsonStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("models/subtypes.json");
final KnockeableDoor knockeableDoor = new KnockeableDoor("Ricky", "Universe 137");
TypedValue<List<Object>> payload = flowRunner("typedValueFunction").withPayload(new TypedValue<>(xmlString, XML_STRING)).withVariable("door", TypedValue.of(knockeableDoor)).withVariable("xmlString", new TypedValue<>(xmlString, XML_STRING)).withVariable("jsonStream", new TypedValue<>(jsonStream, DataType.builder().type(InputStream.class).mediaType(APPLICATION_JSON).build())).run().getMessage().getPayload();
List<Object> values = payload.getValue();
assertThat(values, hasSize(4));
assertThat(getValue(values.get(0)), is(xmlString));
assertThat(getValue(values.get(1)), is(xmlString));
assertThat(getValue(values.get(2)), is(jsonStream));
assertThat(getValue(values.get(3)), is(knockeableDoor));
}
use of org.mule.test.heisenberg.extension.model.KnockeableDoor in project mule by mulesoft.
the class ParameterizedConfigParserTestCase method assertDoors.
private void assertDoors(HeisenbergExtension heisenberg) {
KnockeableDoor door = heisenberg.getRicinGroup().getNextDoor();
assertDoor(door, GUSTAVO_FRING, POLLOS_HERMANOS);
KnockeableDoor previous = door.getPrevious();
assertDoor(door.getPrevious(), KRAZY_8, JESSE_S);
assertNull(previous.getPrevious());
}
use of org.mule.test.heisenberg.extension.model.KnockeableDoor in project mule by mulesoft.
the class ParameterResolverOnConfigTestCase method configurationWithDynamicParameterResolvers.
@Test
public void configurationWithDynamicParameterResolvers() throws Exception {
ParameterResolverConfig config = getPayload("configurationWithDynamicParameterResolvers");
ParameterResolver<KnockeableDoor> doorResolver = config.getDoorResolver();
ParameterResolver<String> stringResolver = config.getStringResolver();
assertParameterResolver(doorResolver, of("#[app.registry.staticDoor]"), is(instanceOf(KnockeableDoor.class)));
assertParameterResolver(stringResolver, of("#[payload]"), is("this is the payload"));
assertThat(config.getLiteralDoor().getLiteralValue().get(), equalTo("#[aDoor]"));
}
use of org.mule.test.heisenberg.extension.model.KnockeableDoor in project mule by mulesoft.
the class ParameterResolverOnConfigTestCase method configurationWithStaticParameterResolvers.
@Test
public void configurationWithStaticParameterResolvers() throws Exception {
ParameterResolverConfig config = getPayload("configurationWithStaticParameterResolvers");
ParameterResolver<KnockeableDoor> doorResolver = config.getDoorResolver();
ParameterResolver<String> stringResolver = config.getStringResolver();
assertParameterResolver(doorResolver, empty(), is(instanceOf(KnockeableDoor.class)));
assertParameterResolver(stringResolver, empty(), is("this is a string"));
}
Aggregations