use of org.mule.runtime.api.meta.model.parameter.ParameterModel 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.parameter.ParameterModel in project mule by mulesoft.
the class DefaultExtensionManagerTestCase method enumTransformer.
@Test
public void enumTransformer() throws Exception {
DefaultExtensionManager extensionsManager = new DefaultExtensionManager();
extensionsManager.setMuleContext(muleContext);
extensionsManager.initialise();
ParameterModel parameter = mock(ParameterModel.class);
when(parameter.getType()).thenReturn(toMetadataType(TimeUnit.class));
ParameterModel parameterOfRepeatedEnumType = mock(ParameterModel.class);
when(parameterOfRepeatedEnumType.getType()).thenReturn(toMetadataType(TimeUnit.class));
mockParameters(extension1ConfigurationModel, parameter, parameterOfRepeatedEnumType);
extensionsManager.registerExtension(extensionModel1);
verify(muleContext.getRegistry()).registerObject(anyString(), any(StringToEnum.class), eq(Transformer.class));
}
use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method stringMetadataKeyWithDefaultValue.
@Test
public void stringMetadataKeyWithDefaultValue() {
ParameterModel param = getMockKeyPartParam("default", 1);
MetadataKeyIdModelProperty keyIdModelProperty = new MetadataKeyIdModelProperty(loader.load(String.class), EMPTY);
when(sourceModel.getModelProperty(MetadataKeyIdModelProperty.class)).thenReturn(of(keyIdModelProperty));
when(sourceModel.getAllParameterModels()).thenReturn(singletonList(param));
validate(extensionModel, validator);
}
use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method metadataKeyWithValidDefaultValues.
@Test
public void metadataKeyWithValidDefaultValues() {
ParameterModel param1 = getMockKeyPartParam("Value", 1);
ParameterModel param2 = getMockKeyPartParam("SomeValue", 2);
MetadataKeyIdModelProperty keyIdModelProperty = new MetadataKeyIdModelProperty(loader.load(InvalidMetadataKeyIdPojo.class), EMPTY);
when(sourceModel.getModelProperty(MetadataKeyIdModelProperty.class)).thenReturn(of(keyIdModelProperty));
when(sourceModel.getAllParameterModels()).thenReturn(asList(param1, param2));
validate(extensionModel, validator);
}
use of org.mule.runtime.api.meta.model.parameter.ParameterModel in project mule by mulesoft.
the class MetadataComponentModelValidatorTestCase method metadataResolverWithRepeatedResolverName.
@Test
public void metadataResolverWithRepeatedResolverName() {
exception.expect(IllegalModelDefinitionException.class);
exception.expectMessage(containsString("Resolver names should be unique for a given category"));
Map<String, Supplier<? extends InputTypeResolver>> inputResolvers = new HashedMap();
ParameterModel parameterModel = mock(ParameterModel.class);
when(parameterModel.getName()).thenReturn(PARAMETER_NAME);
when(parameterModel.getModelProperty(MetadataKeyIdModelProperty.class)).thenReturn(java.util.Optional.empty());
when(sourceModel.getModelProperty(MetadataKeyIdModelProperty.class)).thenReturn(java.util.Optional.empty());
mockParameters(sourceModel, parameterModel);
inputResolvers.put(PARAMETER_NAME, ResolverSupplier.of(SimpleInputResolver.class));
mockMetadataResolverFactory(sourceModel, new DefaultMetadataResolverFactory(NULL_RESOLVER_SUPPLIER, inputResolvers, SIMPLE_OUTPUT_RESOLVER, NULL_RESOLVER_SUPPLIER));
validate(extensionModel, validator);
}
Aggregations