Search in sources :

Example 1 with Value

use of org.mule.runtime.api.value.Value in project mule by mulesoft.

the class SourcesValuesTestCase method multiLevelValue.

@Test
public void multiLevelValue() throws Exception {
    Set<Value> values = getValuesFromSource("source-with-multi-level-value", "values");
    ValueMatcher americaValue = valueWithId("America").withDisplayName("America").withPartName("continent").withChilds(valueWithId("Argentina").withDisplayName("Argentina").withPartName("country").withChilds(valueWithId("Buenos Aires").withDisplayName("Buenos Aires").withPartName("city")));
    assertThat(values, hasValues(americaValue));
}
Also used : ValueMatcher(org.mule.tck.junit4.matcher.ValueMatcher) Value(org.mule.runtime.api.value.Value) Test(org.junit.Test)

Example 2 with Value

use of org.mule.runtime.api.value.Value in project mule by mulesoft.

the class ValueProviderMediator method resolveValues.

private Set<Value> resolveValues(List<ParameterModel> parameters, ValueProviderFactoryModelProperty factoryModelProperty, ParameterValueResolver parameterValueResolver, Supplier<Object> connectionSupplier, Supplier<Object> configurationSupplier) throws NoSuchMethodException, InstantiationException, IllegalAccessException, java.lang.reflect.InvocationTargetException, InitialisationException, org.mule.runtime.module.extension.internal.runtime.ValueResolvingException, ValueResolvingException {
    ValueProvider valueProvider = factoryModelProperty.createFactory(parameterValueResolver, connectionSupplier, configurationSupplier, reflectionCache.get(), muleContext.get()).createValueProvider();
    Set<Value> valueSet = valueProvider.resolve();
    return valueSet.stream().map(option -> cloneAndEnrichValue(option, parameters)).map(ValueBuilder::build).collect(toSet());
}
Also used : ValueProviderUtils.cloneAndEnrichValue(org.mule.runtime.module.extension.internal.value.ValueProviderUtils.cloneAndEnrichValue) Value(org.mule.runtime.api.value.Value) ValueProvider(org.mule.runtime.extension.api.values.ValueProvider)

Example 3 with Value

use of org.mule.runtime.api.value.Value in project mule by mulesoft.

the class OperationValuesTestCase method multiLevelOption.

@Test
public void multiLevelOption() throws Exception {
    Set<Value> values = getValues("multiLevelValue", "values");
    ValueMatcher americaValue = valueWithId("America").withDisplayName("America").withPartName("continent").withChilds(valueWithId("Argentina").withDisplayName("Argentina").withPartName("country").withChilds(valueWithId("Buenos Aires").withDisplayName("Buenos Aires").withPartName("city")));
    assertThat(values, hasValues(americaValue));
}
Also used : ValueMatcher(org.mule.tck.junit4.matcher.ValueMatcher) Value(org.mule.runtime.api.value.Value) Test(org.junit.Test)

Aggregations

Value (org.mule.runtime.api.value.Value)3 Test (org.junit.Test)2 ValueMatcher (org.mule.tck.junit4.matcher.ValueMatcher)2 ValueProvider (org.mule.runtime.extension.api.values.ValueProvider)1 ValueProviderUtils.cloneAndEnrichValue (org.mule.runtime.module.extension.internal.value.ValueProviderUtils.cloneAndEnrichValue)1