use of org.mule.test.heisenberg.extension.model.KnockeableDoor in project mule by mulesoft.
the class AbstractHeisenbergConfigTestCase method getStartUpRegistryObjects.
@Override
protected Map<String, Object> getStartUpRegistryObjects() {
final Map<String, Object> objects = new HashMap<>();
objects.put("recipes", ImmutableMap.<String, Long>builder().put("methylamine", 75l).put("pseudoephedrine", 0l).put("P2P", 25l).build());
objects.put("deathsBySeasons", ImmutableMap.<String, List<String>>builder().put("s01", ImmutableList.<String>builder().add("emilio").add("domingo").build()).put("s02", ImmutableList.<String>builder().add("tuco").add("tortuga").build()).build());
Ricin ricin = new Ricin(new KnockeableDoor("Lidia", "Stevia coffe shop"), 22L);
objects.put("labeledRicins", ImmutableMap.<String, Ricin>builder().put("pojo", ricin).build());
objects.put("monthlyIncomes", ImmutableList.<Long>builder().add(12000L).add(500L).build());
objects.put("enemies", ImmutableList.<String>builder().add("Gustavo Fring").add("Hank").build());
objects.put("ricinPacks", ImmutableSet.<Ricin>builder().add(ricin).build());
objects.put("candidateDoors", ImmutableMap.<String, KnockeableDoor>builder().put("skyler", new KnockeableDoor("Skyler", "308 Negra Arroyo Lane")).put("saul", new KnockeableDoor("Saul", "Shopping Mall")).build());
return objects;
}
use of org.mule.test.heisenberg.extension.model.KnockeableDoor in project mule by mulesoft.
the class OperationExecutionTestCase method operationWithExpressionListParameter.
@Test
public void operationWithExpressionListParameter() throws Exception {
List<KnockeableDoor> doors = Arrays.asList(new KnockeableDoor("Skyler"), new KnockeableDoor("Saul"));
List<String> response = (List<String>) flowRunner("knockManyByExpression").withPayload(EMPTY_STRING).withVariable("doors", doors).run().getMessage().getPayload().getValue();
assertThat(response, Matchers.contains(knock("Skyler"), knock("Saul")));
}
use of org.mule.test.heisenberg.extension.model.KnockeableDoor in project mule by mulesoft.
the class StackableTypesTestCase method configurationWithDynamicParameterResolvers.
@Test
public void configurationWithDynamicParameterResolvers() throws Exception {
NestedWrapperTypesConfig config = getPayload("configurationWithDynamicParameterResolvers");
ParameterResolver<TypedValue<KnockeableDoor>> doorResolver = config.getDoorResolver();
TypedValue<KnockeableDoor> doorTypedValue = doorResolver.resolve();
KnockeableDoor door = doorTypedValue.getValue();
assertThat(door.getVictim(), is("Victim's Name"));
ParameterResolver<TypedValue<InputStream>> lazyParameter = config.getLazyParameter();
Optional<String> expression = lazyParameter.getExpression();
TypedValue<InputStream> resolve = lazyParameter.resolve();
InputStream value = resolve.getValue();
String stringValue = IOUtils.toString(value);
assertThat(expression, is(not(empty())));
assertThat(expression.get(), is("#[output application/json --- {key : 'a nice looking json'}]"));
assertThat(stringValue, is("{\n \"key\": \"a nice looking json\"\n}"));
ParameterResolver<ParameterResolver<ParameterResolver<ParameterResolver<TypedValue<InputStream>>>>> nestedParameter = config.getNestedParameter();
TypedValue<InputStream> nestedTypedValue = nestedParameter.resolve().resolve().resolve().resolve();
InputStream nestedValue = nestedTypedValue.getValue();
String nestedString = IOUtils.toString(nestedValue);
assertThat(nestedString, is("{\n \"key\": \"pretty nested\"\n}"));
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']"));
}
Aggregations