use of org.mule.runtime.core.internal.connection.DefaultConnectionManager in project mule by mulesoft.
the class DefaultsConfigurationBuilder method doConfigure.
@Override
protected void doConfigure(MuleContext muleContext) throws Exception {
MuleRegistry registry = ((MuleContextWithRegistries) muleContext).getRegistry();
new SimpleRegistryBootstrap(APP, muleContext).initialise();
configureQueueManager(muleContext);
registry.registerObject(OBJECT_MULE_CONTEXT, muleContext);
registerObject(OBJECT_SECURITY_MANAGER, new DefaultMuleSecurityManager(), muleContext);
registerObject(BASE_IN_MEMORY_OBJECT_STORE_KEY, createDefaultInMemoryObjectStore(), muleContext);
registerObject(BASE_PERSISTENT_OBJECT_STORE_KEY, createDefaultPersistentObjectStore(), muleContext);
registerLocalObjectStoreManager(muleContext, registry);
registerObject(OBJECT_SCHEDULER_POOLS_CONFIG, SchedulerContainerPoolsConfig.getInstance(), muleContext);
registerObject(OBJECT_SCHEDULER_BASE_CONFIG, config().withPrefix(muleContext.getConfiguration().getId()).withShutdownTimeout(() -> muleContext.getConfiguration().getShutdownTimeout(), MILLISECONDS), muleContext);
registerObject(OBJECT_STORE_MANAGER, new MuleObjectStoreManager(), muleContext);
registerObject(OBJECT_DEFAULT_MESSAGE_PROCESSING_MANAGER, new MuleMessageProcessingManager(), muleContext);
registerObject(OBJECT_MULE_STREAM_CLOSER_SERVICE, new DefaultStreamCloserService(), muleContext);
registerObject(OBJECT_LOCK_PROVIDER, new SingleServerLockProvider(), muleContext);
registerObject(OBJECT_LOCK_FACTORY, new MuleLockFactory(), muleContext);
registerObject(OBJECT_PROCESSING_TIME_WATCHER, new DefaultProcessingTimeWatcher(), muleContext);
registerObject(OBJECT_DEFAULT_RETRY_POLICY_TEMPLATE, new NoRetryPolicyTemplate(), muleContext);
registerObject(OBJECT_CONVERTER_RESOLVER, new DynamicDataTypeConversionResolver(muleContext), muleContext);
registerObject(DEFAULT_OBJECT_SERIALIZER_NAME, new JavaObjectSerializer(), muleContext);
registerObject(OBJECT_EXPRESSION_LANGUAGE, new MVELExpressionLanguage(muleContext), muleContext);
StreamingManager streamingManager = new DefaultStreamingManager();
registerObject(OBJECT_STREAMING_MANAGER, streamingManager, muleContext);
registerObject(OBJECT_EXPRESSION_MANAGER, new DefaultExpressionManager(), muleContext);
registerObject(OBJECT_TIME_SUPPLIER, new LocalTimeSupplier(), muleContext);
registerObject(OBJECT_CONNECTION_MANAGER, new DefaultConnectionManager(muleContext), muleContext);
registerObject(METADATA_SERVICE_KEY, new MuleMetadataService(), muleContext);
registerObject(VALUE_PROVIDER_SERVICE_KEY, new MuleValueProviderService(), muleContext);
registerObject(PROCESSOR_INTERCEPTOR_MANAGER_REGISTRY_KEY, new DefaultProcessorInterceptorManager(), muleContext);
registerObject(OBJECT_NOTIFICATION_DISPATCHER, new DefaultNotificationDispatcher(), muleContext);
registerObject(NotificationListenerRegistry.REGISTRY_KEY, new DefaultNotificationListenerRegistry(), muleContext);
registerObject(EventContextService.REGISTRY_KEY, new DefaultEventContextService(), muleContext);
registerObject(OBJECT_TRANSACTION_FACTORY_LOCATOR, new TransactionFactoryLocator(), muleContext);
registerObject(ComponentInitialStateManager.SERVICE_ID, new ComponentInitialStateManager() {
@Override
public boolean mustStartMessageSource(Component component) {
return true;
}
}, muleContext);
}
use of org.mule.runtime.core.internal.connection.DefaultConnectionManager in project mule by mulesoft.
the class DefaultExecutionMediatorTestCase method enrichThrownException.
@Test
public void enrichThrownException() throws Throwable {
expectedException.expectCause(instanceOf(HeisenbergException.class));
expectedException.expectMessage(ERROR);
mockExceptionEnricher(operationModel, () -> exceptionEnricher);
when(operationExecutor.execute(any())).thenReturn(Mono.error(new Exception()));
Mono.from(new DefaultExecutionMediator(extensionModel, operationModel, new DefaultConnectionManager(muleContext), muleContext.getErrorTypeRepository()).execute(operationExceptionExecutor, operationContext)).block();
}
use of org.mule.runtime.core.internal.connection.DefaultConnectionManager in project mule by mulesoft.
the class SourceConnectionProviderTestCase method before.
@Before
public void before() throws Exception {
when(configurationInstance.getValue()).thenReturn(configurationObject);
connectionManager = new DefaultConnectionManager(muleContext);
connectionManager.bind(configurationObject, connectionProvider);
sourceConnectionProvider = new SourceConnectionProvider(new SourceConnectionManager(connectionManager), configurationInstance);
when(connectionProvider.connect()).thenReturn(connection);
}
use of org.mule.runtime.core.internal.connection.DefaultConnectionManager in project mule by mulesoft.
the class DefaultExecutionMediatorTestCase method before.
@Before
public void before() throws Exception {
when(configurationInstance.getStatistics()).thenReturn(configurationStats);
when(configurationInstance.getName()).thenReturn(DUMMY_NAME);
when(configurationInstance.getModel()).thenReturn(configurationModel);
when(extensionModel.getName()).thenReturn(DUMMY_NAME);
when(extensionModel.getModelProperty(ClassLoaderModelProperty.class)).thenReturn(empty());
mockExceptionEnricher(extensionModel, null);
mockExceptionEnricher(operationModel, null);
when(operationExecutor.execute(operationContext)).thenReturn(just(result));
when(operationExceptionExecutor.execute(operationContext)).thenReturn(error(exception));
when(operationContext.getConfiguration()).thenReturn(Optional.of(configurationInstance));
when(operationContext.getExtensionModel()).thenReturn(extensionModel);
when(operationContext.getTransactionConfig()).thenReturn(empty());
when(operationContext.getRetryPolicyTemplate()).thenReturn(empty());
when(operationContext.getCurrentScheduler()).thenReturn(IMMEDIATE_SCHEDULER);
when(extensionModel.getXmlDslModel()).thenReturn(XmlDslModel.builder().setPrefix("test-extension").build());
mediator = new DefaultExecutionMediator(extensionModel, operationModel, new DefaultConnectionManager(muleContext), muleContext.getErrorTypeRepository());
final ReconnectableConnectionProviderWrapper<Object> connectionProviderWrapper = new ReconnectableConnectionProviderWrapper<>(null, new ReconnectionConfig(true, new SimpleRetryPolicyTemplate(10, RETRY_COUNT)));
initialiseIfNeeded(connectionProviderWrapper, true, muleContext);
Optional<ConnectionProvider> connectionProvider = Optional.of(connectionProviderWrapper);
when(configurationInstance.getConnectionProvider()).thenReturn(connectionProvider);
when(exceptionEnricher.enrichException(exception)).thenReturn(new HeisenbergException(ERROR));
setInterceptors((Interceptable) configurationInstance, configurationInterceptor1, configurationInterceptor2);
setInterceptors((Interceptable) operationExecutor, operationInterceptor1, operationInterceptor2);
defineOrder(configurationInterceptor1, configurationInterceptor2, operationInterceptor1, operationInterceptor2);
}
Aggregations