Search in sources :

Example 1 with ConfigurationFactory

use of org.mule.runtime.extension.api.runtime.config.ConfigurationFactory in project mule by mulesoft.

the class ExtensionsTestUtils method mockConfigurationInstance.

public static void mockConfigurationInstance(ConfigurationModel configurationModel, Object config) {
    ConfigurationFactory configurationFactory = mock(ConfigurationFactory.class);
    when(configurationFactory.newInstance()).thenReturn(config);
    when(configurationFactory.getObjectType()).thenReturn((Class) config.getClass());
    when(configurationModel.getModelProperty(any())).thenAnswer(invocationOnMock -> {
        Class<? extends ModelProperty> propertyType = (Class<? extends ModelProperty>) invocationOnMock.getArguments()[0];
        if (ConfigurationFactoryModelProperty.class.equals(propertyType)) {
            return of(new ConfigurationFactoryModelProperty(configurationFactory));
        }
        return empty();
    });
}
Also used : ConfigurationFactory(org.mule.runtime.extension.api.runtime.config.ConfigurationFactory) InterceptorsModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.InterceptorsModelProperty) ModelProperty(org.mule.runtime.api.meta.model.ModelProperty) ConfigTypeModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ConfigTypeModelProperty) MetadataResolverFactoryModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.MetadataResolverFactoryModelProperty) ConfigurationFactoryModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ConfigurationFactoryModelProperty) ComponentExecutorModelProperty(org.mule.runtime.module.extension.api.loader.java.property.ComponentExecutorModelProperty) ParameterGroupModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ParameterGroupModelProperty) ConnectivityModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ConnectivityModelProperty) ExceptionHandlerModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ExceptionHandlerModelProperty) ClassLoaderModelProperty(org.mule.runtime.extension.api.property.ClassLoaderModelProperty) ImplementingTypeModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ImplementingTypeModelProperty) ConfigurationFactoryModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ConfigurationFactoryModelProperty)

Aggregations

ModelProperty (org.mule.runtime.api.meta.model.ModelProperty)1 ClassLoaderModelProperty (org.mule.runtime.extension.api.property.ClassLoaderModelProperty)1 ConfigurationFactory (org.mule.runtime.extension.api.runtime.config.ConfigurationFactory)1 ComponentExecutorModelProperty (org.mule.runtime.module.extension.api.loader.java.property.ComponentExecutorModelProperty)1 ConfigTypeModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.ConfigTypeModelProperty)1 ConfigurationFactoryModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.ConfigurationFactoryModelProperty)1 ConnectivityModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.ConnectivityModelProperty)1 ExceptionHandlerModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.ExceptionHandlerModelProperty)1 ImplementingTypeModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.ImplementingTypeModelProperty)1 InterceptorsModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.InterceptorsModelProperty)1 MetadataResolverFactoryModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.MetadataResolverFactoryModelProperty)1 ParameterGroupModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.ParameterGroupModelProperty)1