use of org.mule.runtime.api.meta.model.source.SourceModel in project mule by mulesoft.
the class ComplexExtensionDeclarationTestCase method listenerSource.
@Test
public void listenerSource() {
SourceModel source = extensionModel.getConfigurationModel(LISTENER_CONFIG_NAME).get().getSourceModel(LISTEN_MESSAGE_SOURCE).get();
assertType(source.getOutput().getType(), InputStream.class, BinaryType.class);
assertType(source.getOutputAttributes().getType(), Serializable.class, ObjectType.class);
List<ParameterModel> parameters = source.getAllParameterModels();
assertThat(parameters, hasSize(2));
ParameterModel parameter = parameters.get(0);
assertStreamingStrategyParameter(parameter);
parameter = parameters.get(1);
assertThat(parameter.getName(), is(PORT));
assertThat(parameter.isRequired(), is(false));
assertType(parameter.getType(), Integer.class, NumberType.class);
}
use of org.mule.runtime.api.meta.model.source.SourceModel in project mule by mulesoft.
the class DefaultExtensionModelFactoryTestCase method flyweight.
@Test
public void flyweight() {
ExtensionModel extensionModel = createExtension(VeganExtension.class);
final ConfigurationModel appleConfiguration = aggressiveGet(extensionModel.getConfigurationModel(APPLE));
final ConfigurationModel bananaConfiguration = aggressiveGet(extensionModel.getConfigurationModel(BANANA));
final String sourceName = PaulMcCartneySource.class.getSimpleName();
SourceModel appleSource = aggressiveGet(appleConfiguration.getSourceModel(sourceName));
SourceModel bananaSource = aggressiveGet(bananaConfiguration.getSourceModel(sourceName));
assertThat(appleSource, is(sameInstance(appleSource)));
assertThat(bananaSource, is(sameInstance(bananaSource)));
final String operationName = "spreadTheWord";
OperationModel appleOperation = aggressiveGet(appleConfiguration.getOperationModel(operationName));
OperationModel bananaOperation = aggressiveGet(bananaConfiguration.getOperationModel(operationName));
assertThat(appleOperation, is(sameInstance(bananaOperation)));
}
use of org.mule.runtime.api.meta.model.source.SourceModel in project mule by mulesoft.
the class DefaultExtensionModelFactoryTestCase method sourceWithFixedBackPressureStrategy.
@Test
public void sourceWithFixedBackPressureStrategy() {
ExtensionModel extensionModel = createExtension(HeisenbergExtension.class);
SourceModel source = extensionModel.getSourceModels().get(0);
Optional<ParameterModel> parameter = source.getAllParameterModels().stream().filter(p -> BACK_PRESSURE_STRATEGY_PARAMETER_NAME.equals(p.getName())).findAny();
assertThat(parameter.isPresent(), is(false));
}
use of org.mule.runtime.api.meta.model.source.SourceModel in project mule by mulesoft.
the class DefaultExtensionModelFactoryTestCase method sourceWithDefaultBackPressureStrategies.
@Test
public void sourceWithDefaultBackPressureStrategies() {
ExtensionModel extensionModel = createExtension(HeisenbergExtension.class);
SourceModel source = extensionModel.getConfigurationModels().get(0).getSourceModel("ReconnectableListenPayments").get();
Optional<ParameterModel> parameter = source.getAllParameterModels().stream().filter(p -> BACK_PRESSURE_STRATEGY_PARAMETER_NAME.equals(p.getName())).findAny();
assertThat(parameter.isPresent(), is(false));
}
use of org.mule.runtime.api.meta.model.source.SourceModel in project mule by mulesoft.
the class NameClashModelValidatorTestCase method sourceWithRepeatedParameterNameAmongCallbackAndSource.
@Test
public void sourceWithRepeatedParameterNameAmongCallbackAndSource() {
exception.expect(IllegalModelDefinitionException.class);
ParameterModel offending = getParameter(SIMPLE_PARAM_NAME, String.class);
SourceCallbackModel sourceCallbackModel = mock(SourceCallbackModel.class);
mockParameters(sourceCallbackModel, simpleConfigParam);
ParameterGroupModel group = mock(ParameterGroupModel.class);
when(group.getName()).thenReturn(DEFAULT_GROUP_NAME);
when(group.getModelProperty(ParameterGroupModelProperty.class)).thenReturn(empty());
when(group.isShowInDsl()).thenReturn(false);
when(group.getParameterModels()).thenReturn(asList(offending));
SourceModel sourceModel = new ImmutableSourceModel(SOURCE_NAME, "", false, false, asList(group), emptyList(), null, null, of(sourceCallbackModel), empty(), empty(), false, false, false, null, SOURCE, emptySet(), emptySet(), emptySet());
when(extensionModel.getSourceModels()).thenReturn(asList(sourceModel));
validate();
}
Aggregations